sveltejs / kit

web development, streamlined
https://kit.svelte.dev
MIT License
18.17k stars 1.84k forks source link

Server Side Rendered Stream with Promises #12304

Open ShourovRoy opened 1 month ago

ShourovRoy commented 1 month ago

Describe the problem

In Nextjs we can use suspense to render stream data at ssr. Why not in sveltekit.

Describe the proposed solution

Stream with promises should render in ssr too.

Alternatives considered

No response

Importance

i cannot use SvelteKit without it

Additional Information

No response

eltigerchino commented 1 month ago

I think this is what you're looking for: https://kit.svelte.dev/docs/load#streaming-with-promises

ShourovRoy commented 1 month ago

I think this is what you're looking for: https://kit.svelte.dev/docs/load#streaming-with-promises

The data using this method not available in page Source. Its not ssr in sveltkit. Where in nextjs and remix the suspense data are ssr friendly and can be found in page source

eltigerchino commented 1 month ago

Sorry for misunderstanding. So the feature request is to stream HTML instead of load data, right?

Related links:

From builder.io:

A page contains a lot of metadata — most obviously, the . The <title> is problematic for two reasons: It needs to be streamed relatively early in the response It usually depends on database response; as in, <title>Details for $product. These requirements are problematic for solutions that let application components set the (like Helmet), because that means that streaming must pause until whatever component(s) responsible for that title information finish. Such an architecture fundamentally breaks streaming: Any data dependency can block the stream, even if the underlying framework can stream without problems.</p> <p>In practice, this means that a meta-framework must let you send the <head> before later components finish fetching and resolving data. Again, many do not.</p> </blockquote> </div> </div> <div class="page-bar-simple"> </div> <div class="footer"> <ul class="body"> <li>© <script> document.write(new Date().getFullYear()) </script> Githubissues.</li> <li>Githubissues is a development platform for aggregating issues.</li> </ul> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="/githubissues/assets/js.js"></script> <script src="/githubissues/assets/markdown.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/go.min.js"></script> <script> hljs.highlightAll(); </script> </body> </html>