Closed abusada closed 1 year ago
You'll need to hoist useRouter to a level which isn't called inside getServerState, so that useRouter is only called by Next.js
@Haroenv, thanks for the quick response. I confirm that it works when I don't wrap the whole page with getServerState
but only the component that is using InstantSearchSSRProvider
.
Thanks for confirming this fixed your issue!
🐛 Bug description
After upgrading nextjs to version 13.0.5 I started getting:
Error: NextRouter was not mounted.
when doing server side rendering.🔍 Bug reproduction
useRouter
to the page's main codeLive reproduction: Look at
pages/index.tsx
https://replit.com/@FarisAbusada/NextAlgoliaSSR#pages/index.tsx💭 Expected behavior
Expect page to render as it did with previous versions of nextjs.
🖥 Screenshots
Environment