Error 400 when too much multi query
- Dominant language
- TypeScript
- Stars
- 28
- Forks
- 9
- PR merge metrics
- No merged PRs in 30d
Description
## Description
When using `useFrequentlyBoughtTogether` with more than 50 `objectIDs`, we receive an error responde from Algolia.
`{"message":"Too many queries in multi query request","status":400}`
## Reproduction
Its the basic codesandbox with the objectId sent 51 times instead of once.
https://codesandbox.io/s/dreamy-keldysh-rdwthn?file=/app.tsx
**Steps**
1. Open dev tools to see network request
2. Click on the select and choose an item
3. See error 400 in recommendations request
## Expected behavior
The hook should split objectIDs in multiple batch of 50 and send multiple query to Algolia, merge the result and send back.
## Environment
- OS: Windows 10
- Browser: Chrome
- Library version: 114
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the useFrequentlyBoughtTogether hook and reproduce the 400 response using the linked CodeSandbox with more than 50 objectIDs. Done means requests are batched in groups of 50, results are merged, and the recommendation request no longer returns the Algolia error.
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
- 52/100