When using transformItems, loading more items in InfiniteHits is losing items. In the setup where I discovered this, the previous items were removed when loading more. In the Sandbox linked below the newly loaded items are removed after being briefly visible.
It seems to be the explicit combination of transformItems and createInstantSearchRouterNext. Removing the transformation or replacing the next router with the history router both "fix" the issue.
A workaround seems be adding a cache via createInfiniteHitsSessionStorageCache.
🐛 Current behavior
When using
transformItems
, loading more items inInfiniteHits
is losing items. In the setup where I discovered this, the previous items were removed when loading more. In the Sandbox linked below the newly loaded items are removed after being briefly visible.It seems to be the explicit combination of
transformItems
andcreateInstantSearchRouterNext
. Removing the transformation or replacing the next router with thehistory
router both "fix" the issue.A workaround seems be adding a cache via
createInfiniteHitsSessionStorageCache
.Screen recording of Sandbox linked below:
🔍 Steps to reproduce
createInstantSearchRouterNext
sandbox: https://codesandbox.io/s/github/algolia/instantsearch/tree/master/examples/react/next-routingindex.tsx
<Hits hitComponent={Hit} />
with<InfiniteHits hitComponent={Hit} transformItems={(items)=> items} />
Show more results
in previewLive reproduction
https://codesandbox.io/p/devbox/vigorous-kepler-3ymdj5
💭 Expected behavior
Using
transformItems
should not breakInfinitHits
when usingnext/router
.Package version
react-instantsearch 7.13.7, react-instantsearch-router-nextjs 7.13.7
Operating system
No response
Browser
No response
Code of Conduct