You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Load route chunks in parallel with beforeLoad
#8884
Route chunks start loading only after every beforeLoad in the match has resolved (executeClientLane runs contextualize before planSuccessfulLane, whose loader tasks call loadRouteChunk).
That's fine when beforeLoad is fast. Ours isn't: an ssr: false authenticated layout initializes Keycloak and fetches the user's organization in beforeLoad, ~500 ms at 120 ms latency. The layout and page chunks sit idle during that time.
Start used to hide this, because the HTML had modulepreload links for those chunks. After updating Start 1.168.34 → 1.169.4, chunks below the first ssr: false match are no longer preloaded. ~80 modules now start only after beforeLoad. Cold-cache time to home went from 1,339 to 1,433 ms.
Cold-cache time to home: 1,203 ms. Warm cache unaffected.
Proposal: an option to start loading matched route chunks in parallel with beforeLoad, or Start keeping the modulepreload links for ssr: false routes. If waiting is deliberate (don't download code for a page a guard rejects), an opt-in keeps that default.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Route chunks start loading only after every
beforeLoadin the match has resolved (executeClientLanerunscontextualizebeforeplanSuccessfulLane, whose loader tasks callloadRouteChunk).That's fine when
beforeLoadis fast. Ours isn't: anssr: falseauthenticated layout initializes Keycloak and fetches the user's organization inbeforeLoad, ~500 ms at 120 ms latency. The layout and page chunks sit idle during that time.Start used to hide this, because the HTML had
modulepreloadlinks for those chunks. After updating Start 1.168.34 → 1.169.4, chunks below the firstssr: falsematch are no longer preloaded. ~80 modules now start only afterbeforeLoad. Cold-cache time to home went from 1,339 to 1,433 ms.Workaround we use:
Cold-cache time to home: 1,203 ms. Warm cache unaffected.
Proposal: an option to start loading matched route chunks in parallel with
beforeLoad, or Start keeping themodulepreloadlinks forssr: falseroutes. If waiting is deliberate (don't download code for a page a guard rejects), an opt-in keeps that default.Happy to open a PR.
Versions:
@tanstack/react-router1.170.46,@tanstack/router-core1.171.39,@tanstack/react-start1.169.4.Drafted with AI assistance; the measurements are from our app.
All reactions