algolia / algolia/instantsearch
Broken SSR when using InfiniteHitsSessionStorageCache
- Dominant language
- TypeScript
- Stars
- 4.1k
- Forks
- 553
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 51
Description
### 🐛 Current behavior
SSR in Next.js is currently broken when used together with `createInfiniteHitsSessionStorageCache`.
### 🔍 Steps to reproduce
1. Load more results
2. Hard refresh page
3. Hydration error will be displayed
### Live reproduction
https://codesandbox.io/p/sandbox/white-rgb-t5lkyg
### 💭 Expected behavior
Skip loading cache on hydration.
### Package version
react-instantsearch-hooks-web 6.47.1
### Operating system
_No response_
### Browser
_No response_
### Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Contributor guide
Research direction
Start with the linked CodeSandbox and reproduce the hydration error by loading more results before a hard refresh. Trace createInfiniteHitsSessionStorageCache through the Next.js SSR and hydration path; done means the cache is skipped during hydration and the refresh no longer reports a hydration error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- next.js, react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100