Skip to content

Commit b12bb9f

Browse files
samoussHaroenv
authored andcommitted
feat(index): use uiState driven SearchParameters (#4059)
**Summary** This PR replaces the usage of `getConfiguration` for `getWidgetSearchParameters`. The widgets are now driven by the `uiState`. Note that widgets that don't implement the lifecycle can still write on `SearchParameters`, but if a widget that implements the lifecycle use the same parameter it will be always overridden. The lifecycle is now called on `init`, `add` (when the instance is started), `remove` (when the instance is started). On `init` we currently always provide an empty `uiState` (but it will change soon). On `add`/`remove` we provide the local `uiState` of the index to drive the `SearchParameters`.
1 parent 1750a45 commit b12bb9f

File tree

4 files changed

+225
-149
lines changed

4 files changed

+225
-149
lines changed

src/lib/__tests__/InstantSearch-test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,6 @@ describe('start', () => {
449449

450450
search.start();
451451

452-
expect(widget.getConfiguration).toHaveBeenCalledTimes(1);
453452
expect(widget.init).toHaveBeenCalledTimes(1);
454453
});
455454

src/lib/__tests__/RoutingManager-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ describe('RoutingManager', () => {
247247
search.mainIndex.getHelper()!.state.setQuery('test')
248248
);
249249

250-
expect(widget.getWidgetSearchParameters).toHaveBeenCalledTimes(1);
250+
expect(widget.getWidgetSearchParameters).toHaveBeenCalledTimes(2);
251251
expect(widget.getWidgetSearchParameters).toHaveBeenCalledWith(
252252
search.mainIndex.getHelper()!.state,
253253
{

0 commit comments

Comments
 (0)