Skip to content
This repository has been archived by the owner on Sep 24, 2021. It is now read-only.

Progressive server side rendering #25

Open
kaleidawave opened this issue Nov 9, 2020 · 0 comments
Open

Progressive server side rendering #25

kaleidawave opened this issue Nov 9, 2020 · 0 comments
Labels
enhancement New feature or request server-side-rendering Server based render methods

Comments

@kaleidawave
Copy link
Owner

Prism SSR functions will only return once the whole page/content has been string concatenated. This is okay but a technique known as progressive render improves on this process by yielding chunks back that can be written / streamed to the response. Using Transfer-Encoding: chunked in the response header means the client will gradually render in content before the server has ended the response.

These would mean ditching the current template literal approach and instead using yield with a generator function. And there would need to be some figuring out to where to draw the end of chunks while still being correctly parsable by the client.

The other thing is that progressive render is to get content to client before all the data / state has been fully formed on the server rather than to send content before the full concatenation is done. aka progressive render is for dealing with the speed issue of getting data for the view (e.g. accessing and making db requests) rather than the time it takes to do the string concatenation (which is already fast).

This complicates things as rather than sending a fully formed data structure to the render function it requires some sort of partial unresolved state. This can be done is JavaScript with getters, promises and generators but I am unsure of how it would work out in Rust (#19).

@kaleidawave kaleidawave added enhancement New feature or request server-side-rendering Server based render methods labels Nov 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request server-side-rendering Server based render methods
Projects
None yet
Development

No branches or pull requests

1 participant