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 |
shortcuts
left a comment
There was a problem hiding this comment.
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>
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.