I have an issue, which happens just on stage and production servers. On localhost everything works fine.
react-instantsearch-dom inside Next.js project.
The problem is that results, visible for a user, are old, they were fetched by previous search state, not by current one. In other words:
- you see initial search page with all results
- you type search query for a 1st time - nothing changed (but in this step results should be different)
- you change search param/query again and see results from step 2 (in this step you already have 3rd
- you change something - create 4th
SearchState, but see results from step 3
Like one step behind, hope I clearly explained it.
To my mind the problem is in
connectInfiniteHits, because in console I see that Algolia made a correct request (by new
SearchState, also url is updating correctly), in response there is a new portion of data, but inside
connectInfiniteHits component I receive an old portion of data (by previous search state, not by current). It’s soooo bad for user experience and I don’t understand what is wrong.
This is how I’m using it if it makes sense:
Will be appreciate for any suggestion and help!
P.S. this functionality was working fine till some moment, from code perspective I don’t remember I’ve changed something. Truly JS magic.