The widget internally caches all loaded hits. By default, it uses its own internal in-memory cache implementation. We provide another implementation which uses sessionStorage, which is more persistent and lets you restore the scroll position when you leave and come back to the search page.
Here is how this would look:
const sessionStorageCache =
You can find more details on this here: https://www.algolia.com/doc/api-reference/widgets/infinite-hits/js/#widget-param-cache
The sessionStorage should be defined in the same file as the one where infiniteHits widget is defined. In the default theme, the Instant Search widgets are defined in the algolia_instant_search.js.liquid file. But this can also vary if you have defined the widget elsewhere in the code.
Information about Instant Search files for Shopify can be read in the below documentation:
Last reviewed 21-04-22.