Closed StarpTech closed 5 years ago
That issue results in an uncontrol amount of requests to algolia (~16k in 2min)
Is there a reason the example code has AutoComplete
assigned twice?
I think the example is missing out some things, and this is rather about nested connectors causing the infinite loop, do you have the autocomplete wrapped inside a connectHits or similar @StarpTech ?
For finding out where the root issue comes from, I'll need more information, so can you create what you have so far in a sandbox environment? We have a template available for that purpose here. Thanks!
Otherwise, also note that we have a component specifically for autocompletes in a single shot: connectAutoComplete
Is there a reason the example code has AutoComplete assigned twice?
No, fixed.
I think the example is missing out some things, and this is rather about nested connectors causing the infinite loop, do you have the autocomplete wrapped inside a connectHits or similar @StarpTech ?
No, I double checked it.
Otherwise, also note that we have a component specifically for autocompletes in a single shot: connectAutoComplete
Yeah, that would be my workaround but I have no access to isSearchStalled
right?
This example produce the memory leak or at least an unresponsive browser https://codesandbox.io/s/react-instantsearch-app-niiq2 (Save your workspace before :smile: )
Yes, when I remove the keyUp handler in Autocomplete
component it works :small_airplane:
@Haroenv comment in/out the event handler to see the effect. The service worker will run out of memory.
<CustomSearchBox
onKeyUp={handleKeyUp}
not sure if it was fully clear, but if you use connectAutoComplete
, you no longer use connectSearchBox
, since it's a superset, and will indeed cause these infinite loops (#137, algolia/instantsearch.js#5266, unfortunately very hard to solve).
I fixed your code sandbox: https://codesandbox.io/s/react-instantsearch-app-jexcd
Hi @Haroenv thanks for investigation. This is very confusing and frustrating because I can't find a hint in the documentation and the bug costs me more than 100K of my search contingent. If the bugs can't be fixed for years then the implementation should be overhauled.
It's something that we work on, but has a lot of unanswered questions on when requests should be done. This is not something we can just "fix". Please contact support@algolia.com mentioning this ticket about the search requests you didn't expect to be done during development, we can fix that.
closing this for now as it's getting pretty old. For anyone stumbling on a similar problem, the autocomplete experience is documented here:
Describe the bug π
When I pass a property from type
function
to theconnectSearchBox
searchbox the browser gets frozen and the memory will overflow.To Reproduce π
Example (Be careful and save your workspace before) https://codesandbox.io/s/react-instantsearch-app-niiq2
Environment: