What's the problem with background loading JS? Why does it affect TTFB?
-
-
Replying to @wycats @slightlylate and
Honestly, nobody should use SSR if it makes TTFI worse. TTFB also shouldn't be worse but if worse TTFB improves TTFI, seems ok?
1 reply 1 retweet 0 likes -
Replying to @wycats @jlongster and
Most SSR solutions I've traced do not flush() early, delaying delivery of markup to request critical resources; critical path pushed out.
2 replies 0 retweets 1 like -
Replying to @slightlylate @wycats and
This seems particularly framework-centric. Excited to see streaming pulled into this discussion to avoid the TTFB delays.
2 replies 0 retweets 1 like -
Replying to @slightlylate @wycats and
The approach that I've seen that works around this isn't much better: statically SSRing an "entrypoint", rehydrating full app for content
1 reply 0 retweets 0 likes -
Replying to @slightlylate @jlongster and
Hm that doesn't seem like a useful SSR solution. The point of user facing SSR is to get them Googlable content fast.
1 reply 0 retweets 1 like -
Replying to @wycats @jlongster and
Googlebot runs JS; so that works fine. Anyway, we agree that SSR should not delay TTFB = )
3 replies 0 retweets 1 like -
Replying to @slightlylate @wycats and
The broader point about delay loading JS is that it really has to be small chunks to avoid locking up the main thread.
1 reply 0 retweets 1 like -
Replying to @slightlylate @wycats and
So I can imagine many ways to make it work (chunked <script> blocks, e.g.), but haven't seen good solutions in the wild yet.
2 replies 0 retweets 1 like -
Replying to @slightlylate @jlongster and
Unfortunately my best personal solution is eval on demand in chunks, but eval runs up against the religion of CSP.
1 reply 0 retweets 1 like
Basically send app as a JSON payload full of modules strings that you eval when you need 'em. JSON parse off main thread.
-
-
Replying to @wycats @slightlylate and
You can do something similar that is CSP friendly with SW, but we're not there yet for various reasons.
0 replies 0 retweets 0 likesThanks. 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.