Instantsearch hooks: router not getting along with Next.JS
See original GitHub issueWe are trying out a server rendered search implementation with NextJS. All seems okay until we try to add a routing object to InstantSearch. We are using routing to have urls for our search state, and to make them SEO friendly (q=potato&type=tuber). There are all sorts of quirks though, from additional re-renders on load to the rest of the application routing breaking.
1. Re-Render Example:
If we try starting at url /search?q=potato
we immediately see a re-render to /search
.
2. Routing Example:
When we click on a hit/result <Link href={
/post/${hit.slug}>🥔 hit</Link>
we are taken to our expected /post/${hit.slug}
url, but then from there our routing in general seems to be broken. Clicking back moves to /search?q=potato
, but only the url changes. Page content is not updated.
Issue Analytics
- State:
- Created a year ago
- Reactions:33
- Comments:37 (7 by maintainers)
Need this. I’m pretty frustrated after 2 years of developing nextJS applications with algolia that this hasn’t been addressed.
@dhayab do we have an ETA for the native support solution? by that I mean 3rd party routing going along with Algolia InstantSearch
Maybe to have like an example working with NextJS, including SSG, SSR and CSR. The user flow would be like that land on a category (SSG) => facet click to filtered category(SSR) => and for example change sorting (CSR)