-
Notifications
You must be signed in to change notification settings - Fork 4
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
Hydrate state from cookies without server side rendering #22
Comments
As a quick workaround I've created an empty getStaticProps method, which enables state hydration from cookies and doesn't disable Next.js static optimization: const emptyGetStaticProps = wrapper.getStaticProps(() => () => ({
props: {},
}));
// in Page: export const getStaticProps = emptyGetStaticProps |
Hi @MonsterDeveloper, |
I’ve also thought about dispatching hydrate action, but I’m not sure where to take this initial data from. So I think some modifications can be made: Also we don’t need to hydrate state from cookies when navigating pages after initial load. Do you think it’s possible to create such modifications? |
Great, that's what I wanted to hear 😄
That's the problem: We're just a Redux middleware and there's no way for us to simply tell if the current page has these methods – at least none that I know of. I also checked the context argument that |
### [2.1.2](v2.1.1...v2.1.2) (2021-12-13) ### Bug Fixes * Fix client-side hydration on pages without server-side data fetching methods ([8246f5c](8246f5c)), closes [#22](#22)
🎉 This issue has been resolved in version 2.1.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Thank you! I’ll try it soon. |
Hi! I'm trying to implement this library, and it works great, when the page has some SSR methods (like getServerSideProps or others), however, I am missing one important function - it can't hydrate the state from cookies when the page doesn't have SSR.
So I have some state in cookies, and it hydrates perfectly when page has gSSP method. However, when there are no SSR methods on page, next-redux-wrapper doesn't call HYDRATE action and the state is not fetched from cookies.
My question is: can I hydrate the state from cookies on client-side without using gSSP or other server-side rendering methods?
The text was updated successfully, but these errors were encountered: