Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

Commit

Permalink
feat(InstantSearch): support onStateChange (#1149)
Browse files Browse the repository at this point in the history
fixes #1148
  • Loading branch information
Haroenv committed Sep 20, 2022
1 parent a3ce1bc commit badf815
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/components/InstantSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ export default createInstantSearchComponent({
type: Function,
default: undefined,
},
onStateChange: {
type: Function,
default: undefined,
},
initialUiState: {
type: Object,
default: undefined,
Expand Down Expand Up @@ -84,6 +88,7 @@ export default createInstantSearchComponent({
routing: this.routing,
stalledSearchDelay: this.stalledSearchDelay,
searchFunction: this.searchFunction,
onStateChange: this.onStateChange,
initialUiState: this.initialUiState,
}),
};
Expand Down
7 changes: 7 additions & 0 deletions src/util/createInstantSearchComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ export const createInstantSearchComponent = component =>
'Please open a new issue: https://github.com/algolia/vue-instantsearch/issues/new?template=feature.md'
);
},
onStateChange() {
throw new Error(
'onStateChange configuration can not be changed dynamically at this point.' +
'\n\n' +
'Please open a new issue: https://github.com/algolia/vue-instantsearch/issues/new?template=feature.md'
);
},
searchFunction(searchFunction) {
// private InstantSearch.js API:
this.instantSearchInstance._searchFunction = searchFunction;
Expand Down

0 comments on commit badf815

Please sign in to comment.