Repository navigation
Replies: 1 comment
|
We use Keycloak behind an authenticated layout too, so this one hits close to home. +1 for making it opt-in. Waiting makes sense when a guard is likely to redirect, but for an auth layout that almost every visit passes, it just serializes two independent network waits. Your onBeforeLoad workaround is nice and small. The only cost I can see is downloading page chunks for nothing when the guard does redirect to login, which is probably cheap compared to the time saved. If |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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