3 ms·
I think the major missing principle on this list is "streaming." (This is missing in Next, too.) The server should send down parts of the page as soon as their
by dfabulich 9y ago
I think the major missing principle on this list is "streaming." (This is missing in Next, too.)
The server should send down parts of the page as soon as their data becomes available. Typically, pages have a "header" section that requires no data at all, and the server should render it instantly and stream it to the client. Then there's typically some fast-loading "above-the-fold" data; the server should render and stream that as soon as it's ready. Beyond that, there's other below-the-fold components, which may load/render more slowly. The server should render those as they come in.
Then, the magic technique is to progressively attach event listeners to components as they stream in, so you don't have to wait for the whole page to load to be able to interact with above-the-fold components.
- rich_harris 9y agoSapper supports partial streaming if you have data that needs to be loaded asynchronously (i.e. you'll get most of the <head> immediately, then other stuff later), but it doesn't currently do what you suggest (such as loading a <header> while <main> is pending). That's something that we intend to tackle in future, though hydrating pages with async data dependencies is a hard problem.