-
Notifications
You must be signed in to change notification settings - Fork 39
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
Hydration Issue nextjs #65
Comments
Any progress here? Personally I ended up moving the recoil state call to another wrapper component and forced to CSR with next/dynamic like below: import dynamic from 'next/dynamic'
// ...
const SomeRecoilStateWrapper = dynamic(
() => Promise.resolve(SomeRecoilStateContainer),
{ ssr: false }
)
function SomeRecoilStateContainer () {
const value = useRecoilValue(...) // recoil atom using recoil-persist
// ...
} But I would really like to see a better solution here |
I thought this kind of problem has been fixed on #24 , don't know why this problem has still appeared now |
there is a missmatch error using recoil, when you use concurrent mode or startTransition, recoil-persist get hydrated before all render and this does not match with server at all ofcourse |
same here. Here is a simplified code, and sorry for my bad English. .tsx ...
<button type='button' onClick={() => onClick( {id: e.id} )}>
<FontAwesomeIcon icon={recoilTest.findIndex((i) => i.id === e.id) !== -1 ? faStar : faHeart} />
</button>
... recoil.ts const { persistAtom } = recoilPersist()
export const recoilTest = atom({
key: 'recoilTest',
default: [{id: '1'}],
effects_UNSTABLE: [persistAtom],
}) next: |
same here. this issue has been quite long nobody answer :( is recoil project dead? |
I have added a section to README |
https://stackoverflow.com/questions/68110629/nextjs-react-recoil-persist-values-in-local-storage-initial-page-load-in-wrong/73536131?noredirect=1#comment129857349_73536131
I've gone through this question but the value stored in the state of my atom is an object that is returned by an API call which is relatively complex compared to the boolean value mentioned in the stackoverflow question above. Unlike the case above, I don't think I can set the value of SSR to be the same as the CSR. How should I handle the hydration? Or can I just ignore the issue? WIll it impact the website when it is deployed to production?
The text was updated successfully, but these errors were encountered: