-
Notifications
You must be signed in to change notification settings - Fork 398
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
fix(searchbutton): fix react hydration error #1384
Conversation
✅ Deploy Preview for docsearch ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 375144e:
|
@shortcuts If you have time, I'd be happy to have you review it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
IIRC we switched to useMemo
to prevent a UI flash, but it was not the solution and did not reverted the change. cc @francoischalifour
Can you confirm this fixes the production only? Locally I was still getting the error for dev builds
Co-authored-by: Clément Vannicatte <vannicattec@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
I confirmed both production build and dev build and they work well. I got the error at the first too, but realized it was due to the build cache. After removing the |
fix #1242
After upgrading React v18, the error of react hydration mismatch happens not only in dev but also in prod.
I fixed this error by using useEffect, following the Next.js documentation, https://nextjs.org/docs/messages/react-hydration-error.