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.
Sapper supports partial streaming if you have data that needs to be loaded asynchronously (i.e. you'll get most of the immediately, then other stuff later), but it doesn't currently do what you suggest (such as loading a while is pending). That's something that we intend to tackle in future, though hydrating pages with async data dependencies is a hard problem.
Comments (209) 32 threads
Show all comments
Showing thread 12 of 32
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.