Asynchronously loading the nextjs useRouter hook within an Event handler for optimized history access?

Hey so I have been building an instantsearch for work – it’s in a monorepo with sanity and using nextjs+typescript

in one repo there’s a vercel deployed server-side-state-context provider setup

in the other repo there’s a cloudflare-deployed relatively static setup within the react itself – a handful of cloudflare functions for things like geo location etc which I am actually wondering what the best approach to injecting the SearchClient with a users geocoord would be? should we just set them to an arbitrary value from getStaticProps during prod build so they’re populated prior to initial render?

Anyway, I love AlgoliaSearch, started with the class components ~3.5 weeks ago and switched to hooks ~2.5 weeks ago. A preview link is here

I have noticed that in the vercel repo any use of the useRouterHook within any child component rendered in that context throws an error

that does not happen when it’s predominantly static

so, would importing the useRouter() hook for shallow routing via next context as shown below result in any clashing with the algolia client?


https://hcms-takedajobs.pages.dev