diff --git a/src/node_modules/@internal/micro-frame-component/components/ssr-wait.marko b/src/node_modules/@internal/micro-frame-component/components/ssr-wait.marko new file mode 100644 index 0000000..73968c0 --- /dev/null +++ b/src/node_modules/@internal/micro-frame-component/components/ssr-wait.marko @@ -0,0 +1,26 @@ + + <@then|{ value, done }|> + + + + $ out.script( + `((e,t,d)=>{t=document.getElementById(e);do{t.removeChild(d=t.firstChild)}while(d.data!==e)})(${JSON.stringify(input.id)});`, + ); + + + + $!{value} + + + + <@catch|err|> + + + $ out.write(``); + <${input.catch}(err)/> + + + $ throw err; + + + diff --git a/src/node_modules/@internal/micro-frame-component/node.marko b/src/node_modules/@internal/micro-frame-component/node.marko index 280f2c8..3b3b2b4 100644 --- a/src/node_modules/@internal/micro-frame-component/node.marko +++ b/src/node_modules/@internal/micro-frame-component/node.marko @@ -98,36 +98,13 @@ static async function fetchStream(input, out) { $ out.bf("@_", component, true); <@then|iter|> - - - <@then|{ value, done }|> - - - - $ out.script( - `((e,t,d)=>{t=document.getElementById(e);do{t.removeChild(d=t.firstChild)}while(d.data!==e)})(${JSON.stringify(component.id)});`, - ); - - - - $!{value} - - - - <@catch|err|> - - - - <${input.catch}(err)/> - - - $ throw err; - - - - - - + $ out.ef(); diff --git a/src/node_modules/@internal/micro-frame-slot-component/components/ssr-wait.marko b/src/node_modules/@internal/micro-frame-slot-component/components/ssr-wait.marko new file mode 100644 index 0000000..9e2f93c --- /dev/null +++ b/src/node_modules/@internal/micro-frame-slot-component/components/ssr-wait.marko @@ -0,0 +1,23 @@ + + <@then|{ value, done }|> + + $!{value} + + + + $ input.finishLoading(); + + + <@catch|e|> + $ input.finishLoading(); + $ out.write(``); + <${input.catch}(e)/> + + diff --git a/src/node_modules/@internal/micro-frame-slot-component/node.marko b/src/node_modules/@internal/micro-frame-slot-component/node.marko index ba7d801..7a8e9bc 100644 --- a/src/node_modules/@internal/micro-frame-slot-component/node.marko +++ b/src/node_modules/@internal/micro-frame-slot-component/node.marko @@ -1,40 +1,35 @@ import { getSource } from "../../../util/stream"; - -$ { - const streamSource = getSource(input.from, out); - const stream = streamSource.slot(input.slot); - let finishLoading; - const loadingPromise = - input.loading && new Promise((res) => (finishLoading = res)); -} -
- - - <@then|{ value, done }|> - - $!{value} - - - - $ finishLoading && finishLoading(); - - - <@catch|e|> - $ finishLoading && finishLoading(); - - <${input.catch}(e)/> - - - +$ const streamSource = getSource(input.from, out); +$ const stream = streamSource.slot(input.slot); +$ let finishLoading; +$ const loadingPromise = ( + input.loading && new Promise((res) => (finishLoading = res)) +); +
$ out.bf("@_", component, true); - + - + finishLoading && finishLoading()) + loaded=false + catch=input.catch + /> $ out.ef();