From badf8154f0869ea6449091ac97738e1eb491412b Mon Sep 17 00:00:00 2001 From: Haroen Viaene Date: Tue, 20 Sep 2022 10:11:33 +0200 Subject: [PATCH] feat(InstantSearch): support onStateChange (#1149) fixes #1148 --- src/components/InstantSearch.js | 5 +++++ src/util/createInstantSearchComponent.js | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/src/components/InstantSearch.js b/src/components/InstantSearch.js index 7af5a427..928f9f23 100644 --- a/src/components/InstantSearch.js +++ b/src/components/InstantSearch.js @@ -46,6 +46,10 @@ export default createInstantSearchComponent({ type: Function, default: undefined, }, + onStateChange: { + type: Function, + default: undefined, + }, initialUiState: { type: Object, default: undefined, @@ -84,6 +88,7 @@ export default createInstantSearchComponent({ routing: this.routing, stalledSearchDelay: this.stalledSearchDelay, searchFunction: this.searchFunction, + onStateChange: this.onStateChange, initialUiState: this.initialUiState, }), }; diff --git a/src/util/createInstantSearchComponent.js b/src/util/createInstantSearchComponent.js index b64703b3..11786abc 100644 --- a/src/util/createInstantSearchComponent.js +++ b/src/util/createInstantSearchComponent.js @@ -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;