-
-
Notifications
You must be signed in to change notification settings - Fork 266
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
Data from store is undefined after client-side routing transition #495
Comments
This comment was marked as outdated.
This comment was marked as outdated.
I'm looking into it further. Stay tuned. |
* Use useMemo for hydration and avoid unnecessary hydrates (#502) * Upgrade packages and refactor a bit * Added necessary testing dependency * Stop hydrating on server and use useLayoutEffect for client hydration * Added pokemon page with rtk's createApi * Added back dispatch in GSP in demo repo * A change in query params constitutes a new page now * Improve performance by using another hook on server * Add detail page * New approach: split gsp and gssp and hydrate based on those * Added a second type of initial state handling with more explanations * Improved useMemo comment * Make sure hydrates work when staying on the same page * Add links to demo repo to test issue (seems like no issue) * Proper gipp fix (#512) * ESLint fix * Gipp testcase and example page in RTK repo (#514) * Add GIP to _app and add GIP in page to RTK repo * Added e2e test for RTK repo * Added testcase for GIAP and GIPP to wrapper * Consistent casing and formatting in comments Fix #493 #495 #496 Co-authored-by: voinik <[email protected]>
Client hydration stopped working for me after updating to 8.1.0: store stays undefined indefinitely. The exact page uses incremental regeneration with It worked okay'ish on 8.0.0: client wasn't hydrating on initial render, but at least hydration did push its state after awhile. Now on 8.1.0 it's complete silence. @kaguya3222 what's your experience with this update, did it fix your issue? |
@MrNovado To be honest, I haven't updated yet. Will check in the next days and provide feedback :) |
@kirill-konshin I've just checked the same repro using @MrNovado For me it fixed my issue, however, I was testing with |
Describe the bug
I use Next.js, rtk-query and next-redux-wrapper. I use
getServerSideProps
to set the initial state for the store on server and give a user a pre-rendered html page. So I expect that data from store will be immediately accessible on client, because it's set on the server. But when I'm using 8.0.0 version ofnext-redux-wrapper
, after setting initial state on server the data isundefined
on client after client-side routing transition for first several ticks of rendering. So I can't immediately use initial state of store on client, because store doesn't have initial state from server.To Reproduce
Steps to reproduce the behavior:
Expected behavior
The pokemon name is shown because store state should be set on the server and be immediately accessible on client.
Desktop (please complete the following information):
Additional context
Everything works if I use
next-redux-wrapper
7.0.5
version. The logic of 'setting initial state of store on the server' is located in pages/[pokemon].tsx fileThe text was updated successfully, but these errors were encountered: