question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Instantsearch hooks: router not getting along with Next.JS

See original GitHub issue

We 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.

StepBrothers_3lg copy

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:33
  • Comments:37 (7 by maintainers)

github_iconTop GitHub Comments

29reactions
bramskicommented, Oct 18, 2022

Need this. I’m pretty frustrated after 2 years of developing nextJS applications with algolia that this hasn’t been addressed.

17reactions
ddaoxuancommented, Oct 6, 2022

@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)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Instantsearch hooks: router not getting along with Next.JS #5241
We are trying out a server rendered search implementation with NextJS. All seems okay until we try to add a routing object to...
Read more >
NextJS Router with react-instantsearch-hooks - Open Q&A
We're currently working on NextJS e-commerce, and we want to power our pages ... Instantsearch hooks: router not getting along with Next.JS.
Read more >
How do I sync my search state with Url and connect it to next.js ...
An I'm having difficulty understanding how this would work in next js, because how can I connect the searchStateToUrl function to my next...
Read more >
react-instantsearch-hooks-web examples - CodeSandbox
Learn how to use react-instantsearch-hooks-web by viewing and forking react-instantsearch-hooks-web example apps on CodeSandbox.
Read more >
react-instantsearch | Yarn - Package Manager
This is the React version of Algolia's instantsearch library. ... 6.38.1 (2022-11-08). Bug Fixes. hooks: avoid effect in useStableValue (#3670 (d1f53ae) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found