-
Notifications
You must be signed in to change notification settings - Fork 530
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(index): ensure that we always use the index set by widgets (#4125)
This PR fixes an issue where the initial index name is not correctly set. When a widget manages the `index` (e.g. `sortBy`), the first computation of the `SearchParameters` could be incorrect. This is because the `Helper` **always override** the `index` provided by the last argument (see [L124](https://github.com/algolia/algoliasearch-helper-js/blob/5a0352aa233c5ea932df6b054a16989c8d302404/src/algoliasearch.helper.js#L124)). The value set by the widget will be overridden anyway. We now first compute the `SearchParameters` from the widgets with an initial value that contains the top-level `indexName`. If one of the widgets overrides it the return value will contain the correct index if not the original index is preserved (this is not true at the moment, `connectSortBy` will be fixed in a separate #4126). Then we use the return value for both arguments of the Helper.
- Loading branch information
Showing
3 changed files
with
49 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters