Skip to content

Commit

Permalink
feat(vue 3): support inject without this (algolia/vue-instantsearch…
Browse files Browse the repository at this point in the history
  • Loading branch information
Eunjae Lee authored Jun 1, 2021
1 parent 25372a4 commit 8348d3d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/vue-instantsearch/src/mixins/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@ export const createWidgetMixin = ({ connector } = {}) => ({
);
},
},
getParentIndex: {
from: '$_ais_getParentIndex',
default() {
return () => this.instantSearchInstance.mainIndex;
},
},
getProvidedParentIndex: '$_ais_getParentIndex',
},
data() {
return {
Expand Down Expand Up @@ -72,6 +67,11 @@ Read more on using connectors: https://alg.li/vue-custom`
},
},
methods: {
getParentIndex() {
return this.getProvidedParentIndex
? this.getProvidedParentIndex()
: this.instantSearchInstance.mainIndex;
},
updateState(state = {}, isFirstRender) {
if (!isFirstRender) {
// Avoid updating the state on first render
Expand Down

0 comments on commit 8348d3d

Please sign in to comment.