-
-
Notifications
You must be signed in to change notification settings - Fork 495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File lazy loading + SSR hydration issues #1115
Comments
Will quote my message here that I sent several days ago to discord chat I solved the problem by adding
|
I'm facing the same issue, really wish there was an example of this in the repository's examples folder so people could know the recommended implementation. Even though I've used |
@kcoet the suggest by @ushakovfserg worked for me - no luck on your end? Everything seems to be working in the ssr example I put together w SSRx - the load call is here -> https://github.com/TanStack/router/pull/1125/files#diff-e6355028e3797dc040644e9b512ab3da39c1da49fe9ba8af31dcc97abf331abfR13 |
@marbemac It doesn't seem to be a problem in tanstack-router, but a problem in my Apollo configuration. I tried modifying it to use codesplitting https://github.com/TanStack/router/tree/main/examples/react/basic-ssr-file-based , it worked fine. Hoping there's an example of Apollo's use. |
Quick follow-up, while the |
Describe the bug
Loading an SSR page that has a lazy file route leads to hydration errors (dev and prod) and a broken app.
Your Example Website or App
examples in this repo
Steps to Reproduce the Bug or Issue
index.lazy.tsx
and adjusted lazy route export)Additional context
The dynamic import is never invoked on the client on first load.
If you manually adjust the basic-ssr-file-based generated route tree to leverage the old style
lazyRouteComponent
, theindex.lazy.tsx
is correctly fetched on page load.Compare that to the lazy file route approach and note that
index.lazy.tsx
is not fetched on page load (I guess the route'slazyFn
is never invoked? Haven't dug deep yet), leading to hydration errors and a broken page:The text was updated successfully, but these errors were encountered: