Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 15 |
| Duplication | 0 |
TIP This summary will be updated as you push new changes. Give us feedback
More templates
algoliasearch-helper
instantsearch-ui-components
instantsearch.css
instantsearch.js
react-instantsearch
react-instantsearch-core
react-instantsearch-nextjs
react-instantsearch-router-nextjs
vue-instantsearch
commit: |
Haroenv
left a comment
There was a problem hiding this comment.
the fix works! Do you know why we did this originally, was it in the first merge already? we should also add tests to ensure the right searches happen. This can be in CTS normally
Screen.Recording.2026-04-09.at.09.34.49.movwas this before already? if you refine and then go back to empty query it will show the refined query. Probably something to do with EDIT: I see what happened, this was implemented in the POC but not the proper version: https://github.com/algolia/instantsearch/pull/6745/changes#r3056209902 |
|
@Haroenv please check now :) |
…arch-if-submitted
Haroenv
left a comment
There was a problem hiding this comment.
very good! there's another small edge case showing now, which is that refining with empty query doesn't seem to happen, is there a guard somewhere that doesn't refine if the query is falsy ''?
Summary
In the React EXPERIMENTAL_Autocomplete widget, every keystroke in the search input was triggering 2 separate API calls, one on the parent index (via useSearchBox.refine) and one on the isolated autocomplete index (via useAutocomplete.refine). Since the autocomplete uses EXPERIMENTAL_isolated, these are two separate search lifecycles, resulting in duplicate searchClient.search() calls on every keystroke.
This change removes the redundant parent search call from the onChange handler so that typing only triggers 1 API call (the isolated autocomplete search). The parent index is still updated when the user submits (Enter key), selects a suggestion, or clears the input, matching the behavior of the instantsearch.js widget which already handled this correctly.
Result
Typing in the autocomplete input triggers 1 API call per keystroke instead of 2
Autocomplete suggestions still update live as you type
Parent search results update on submit/selection as expected