Skip to content

Commit

Permalink
feat(index): use uiState driven SearchParameters (#4059)
Browse files Browse the repository at this point in the history
**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`.
  • Loading branch information
samouss authored and Haroenv committed Oct 23, 2019
1 parent 1750a45 commit b12bb9f
Show file tree
Hide file tree
Showing 4 changed files with 225 additions and 149 deletions.
1 change: 0 additions & 1 deletion src/lib/__tests__/InstantSearch-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,6 @@ describe('start', () => {

search.start();

expect(widget.getConfiguration).toHaveBeenCalledTimes(1);
expect(widget.init).toHaveBeenCalledTimes(1);
});

Expand Down
2 changes: 1 addition & 1 deletion src/lib/__tests__/RoutingManager-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ describe('RoutingManager', () => {
search.mainIndex.getHelper()!.state.setQuery('test')
);

expect(widget.getWidgetSearchParameters).toHaveBeenCalledTimes(1);
expect(widget.getWidgetSearchParameters).toHaveBeenCalledTimes(2);
expect(widget.getWidgetSearchParameters).toHaveBeenCalledWith(
search.mainIndex.getHelper()!.state,
{
Expand Down
Loading

0 comments on commit b12bb9f

Please sign in to comment.