algolia / algolia/instantsearch
Configure doesn't accept offset + length. Error is thrown
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 4.1k
- Forks
- 554
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 51
Description
Describe the bug 🐛
Error is thrown if offset and length is passed to <Configure />.
To Reproduce 🔍
https://codesandbox.io/s/elated-dawn-cfb89?file=/src/App.js
Expected behavior 💭
Should display up to the number of items configured in the length property.
Screenshots 🖥


--
My use case for using offset & length is: in the initial page, I don't want to show pagination and want to restrict to only that fixed number of results, and then if facets are applied, then I'd let the user paginate. This was working normally on 6.4.0, but, after updating to 6.7.0 it is now breaking.
As you can see in the attached screenshot, Algolia does cap the number of hits to the desired number, however, it throws an error when rendering.
One other thing which's definitely related to that is: when I use connectInfiniteHits and SSR, the initial hits array is [undefined]. I have to .filter(Boolean) so my application doesn't crash, but still, the array comes empty if offset and length is passed to <Configure />.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked CodeSandbox reproduction and the usage, then compare behavior between versions 6.4.0 and 6.7.0 for offset and length, including connectInfiniteHits during SSR. Done means rendering no longer throws, the configured number of hits is displayed, and the initial SSR hits array is not [undefined].
Written by the indexing model from the issue text.
Assessment
- Tech stack
- 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