Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(index): support custom UI params in inconsistent UI state warning #4165

Merged
merged 4 commits into from
Oct 14, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/lib/__tests__/InstantSearch-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,13 @@ describe('UI state', () => {
menu: {
category: 'Hardware',
},
// `places` is a UI parameter that is not supported by default but that
// can be added when using custom widgets. Having it in `initialUiState`
// makes sure that it doesn't throw if it happens.
places: {
query: 'Paris',
location: ['1', '1'],
},
},
},
});
Expand Down
4 changes: 4 additions & 0 deletions src/widgets/index/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,10 @@ const index = (props: IndexProps): Index => {
const requiredWidgets: Array<Widget['$$type']> =
stateToWidgetsMap[parameter];
francoischalifour marked this conversation as resolved.
Show resolved Hide resolved

if (!requiredWidgets) {
return acc;
}

if (
!requiredWidgets.some(requiredWidget =>
mountedWidgets.includes(requiredWidget)
Expand Down