How do you update InfiniteHits session storage cache? #5306
-
Pretty contrived example above. Question is how do you update hits after you make some partial updates in the backend? Reloading the browser seems to not make any difference... Doing a search with the given Hit included with the results shows the updated values but the one's saved in Session Storag has old values. Doing |
Beta Was this translation helpful? Give feedback.
Replies: 0 comments 4 replies
-
There's indeed no out-of-the-box solution for this yet, but the key is Note that accessing Note that you probably want to set the page back to zero at that point too, depending on your implementation. Hope that helps! |
Beta Was this translation helpful? Give feedback.
There's indeed no out-of-the-box solution for this yet, but the key is
ais.infiniteHits
in sessionStorage, so if you clear that key before doinginstantsearch.refresh()
, it should work as expected. Something like this should work: https://codesandbox.io/s/hardcore-tharp-zhkpoe?file=/src/App.js:749-840Note that accessing
search.refresh()
requires you to importInstantSearchContext
, which isn't yet exported from the root, as we haven't decided on the best way to expose it.Note that you probably want to set the page back to zero at that point too, depending on your implementation.
Hope that helps!