I'm guilty of this too (Sapper serializes preloaded data — equivalent to getInitialProps in Next.js — and includes it to avoid `preload` running on both server and client). Are you saying that it'd be better to fetch that same 300kb asyncly even if TTI suffers as a result?
-
-
Replying to @Rich_Harris
Not exactly... This approach can be great in moderation; the problem is over-inclusion in the startup snapshot. Too much data, too little of it used. Delay load what isn't in the critical path.
1 reply 0 retweets 8 likes -
Replying to @slightlylate
tricky problem to solve at the tooling level I suppose. If you're streaming the HTML response, and the 300kb is inlined at the bottom of the page, does that sufficiently mitigate the problem?
2 replies 0 retweets 2 likes -
Replying to @Rich_Harris @slightlylate
Bottom > start. Ideally each component has it’s own trailer of data that you can flush before waiting for more data. Assuming your system even supports incremental flushing of responses. React-ish component systems typically don't allow for this.
2 replies 0 retweets 4 likes -
Replying to @cramforce @Rich_Harris
Right, and I'm mostly seeing this in React apps where the model bootstrap is used to re-generate a bunch of already functional DOM. This gives me many feels.
1 reply 0 retweets 4 likes -
Replying to @slightlylate @cramforce
yeah, it's wasteful. i've found it quite hard to think up general solutions to hydrating server-rendered DOM that don't involve duplicating stuff between markup and data. v interested in any examples you can share
1 reply 0 retweets 2 likes -
Replying to @Rich_Harris @cramforce
The CS-ish solution would be flyweight components that only really hydrate (or re-create) when processing input events.
2 replies 0 retweets 6 likes -
A lazier solution would be to only serialize data which was consumed in component generation for SSR and leave stubs for the rest.
2 replies 0 retweets 3 likes -
...but these apps also seem to be bundling all components, not just those used on the route/page, so IDK. "DX" has apparently liberated minds from the confines of mere physics.
2 replies 0 retweets 0 likes -
Replying to @slightlylate @cramforce
well *that* problem at least is easily solved
1 reply 0 retweets 0 likes
...once your acknowledge it's an issue. The Cult of DX preaches that in the fullness of time, the path to (en)lightenment will be baked into your existing tools without any effort or understanding on your part.
-
-
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
& Web Standards TL; Blink API OWNER
Named PWAs w/
DMs open. Tweets my own; press@google.com for official comms.