-
Notifications
You must be signed in to change notification settings - Fork 557
Description
🐛 Current behavior
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.
Screen recording of Sandbox linked below:

🔍 Steps to reproduce
- Go to official
createInstantSearchRouterNextsandbox: https://codesandbox.io/s/github/algolia/instantsearch/tree/master/examples/react/next-routing - Open
index.tsx - Replace
<Hits hitComponent={Hit} />with<InfiniteHits hitComponent={Hit} transformItems={(items)=> items} /> - Click
Show more resultsin preview - See newly added items being removed after a moment
Live reproduction
https://codesandbox.io/p/devbox/vigorous-kepler-3ymdj5
💭 Expected behavior
Using transformItems should not break InfinitHits when using next/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
- I agree to follow this project's Code of Conduct