-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix issue with custom fetch function (#7)
- Loading branch information
Showing
11 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
...ents/micro-frame/__tests__/__snapshots__/csr-custom-fetch/renders.expected/loading.0.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<div> | ||
Host app | ||
</div> | ||
<script> | ||
$csr_custom_fetch_index_C=(window.$csr_custom_fetch_index_C||[]).concat({"l":1,"w":[["s0-8",0,{},{"f":1}]],"t":["Bj+pRfsl"]}) | ||
</script> |
7 changes: 7 additions & 0 deletions
7
...ents/micro-frame/__tests__/__snapshots__/csr-custom-fetch/renders.expected/loading.1.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<div> | ||
Host app | ||
</div> | ||
<div /> | ||
<script> | ||
$csr_custom_fetch_index_C=(window.$csr_custom_fetch_index_C||[]).concat({"l":1,"w":[["s0-8",0,{},{"f":1}]],"t":["Bj+pRfsl"]}) | ||
</script> |
9 changes: 9 additions & 0 deletions
9
...ents/micro-frame/__tests__/__snapshots__/csr-custom-fetch/renders.expected/loading.2.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<div> | ||
Host app | ||
</div> | ||
<div> | ||
Custom fetch(src: embed) content. | ||
</div> | ||
<script> | ||
$csr_custom_fetch_index_C=(window.$csr_custom_fetch_index_C||[]).concat({"l":1,"w":[["s0-8",0,{},{"f":1}]],"t":["Bj+pRfsl"]}) | ||
</script> |
9 changes: 9 additions & 0 deletions
9
...ents/micro-frame/__tests__/__snapshots__/ssr-custom-fetch/renders.expected/loading.0.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<div> | ||
Host app | ||
</div> | ||
<div | ||
data-src="embed" | ||
id="GENERATED-0" | ||
> | ||
Custom fetch(src: /embed) content. | ||
</div> |
23 changes: 23 additions & 0 deletions
23
src/components/micro-frame/__tests__/fixtures/csr-custom-fetch/components/app.marko
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
class { | ||
onCreate() { | ||
this.state = { mounted: false }; | ||
} | ||
onMount() { | ||
this.state.mounted = true; | ||
} | ||
} | ||
|
||
<if(state.mounted)> | ||
<micro-frame src="embed" fetch(src) { | ||
return new Promise(resolve => { | ||
const stream = new ReadableStream({ | ||
start(controller) { | ||
const encoder = new TextEncoder(); | ||
controller.enqueue(encoder.encode(`Custom fetch(src: ${src}) content.`)); | ||
controller.close(); | ||
} | ||
}); | ||
resolve({ ok: true, body: stream }); | ||
}); | ||
} /> | ||
</if> |
4 changes: 4 additions & 0 deletions
4
src/components/micro-frame/__tests__/fixtures/csr-custom-fetch/embed.marko
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<esbuild-assets/> | ||
<div> | ||
Embedded App. | ||
</div> |
13 changes: 13 additions & 0 deletions
13
src/components/micro-frame/__tests__/fixtures/csr-custom-fetch/index.marko
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Simple Example</title> | ||
<esbuild-assets/> | ||
</head> | ||
<body> | ||
<div>Host app</div> | ||
<app/> | ||
</body> | ||
</html> |
4 changes: 4 additions & 0 deletions
4
src/components/micro-frame/__tests__/fixtures/ssr-custom-fetch/embed.marko
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<esbuild-assets/> | ||
<div> | ||
Embedded App. | ||
</div> |
20 changes: 20 additions & 0 deletions
20
src/components/micro-frame/__tests__/fixtures/ssr-custom-fetch/index.marko
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Simple Example</title> | ||
<esbuild-assets/> | ||
</head> | ||
<body> | ||
<div>Host app</div> | ||
<micro-frame src="embed" fetch(src) { | ||
async function* customFetch() { | ||
yield `Custom fetch(src: ${src}) content.`; | ||
} | ||
return new Promise(resolve => { | ||
resolve({ ok: true, body: customFetch() }); | ||
}); | ||
} /> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters