Skip to content

Commit

Permalink
Merge pull request algolia/vue-instantsearch#359 from algolia/stop-st…
Browse files Browse the repository at this point in the history
…ore-before-removing-facets

fix: avoid query when components are destroyed
  • Loading branch information
rayrutjes authored Nov 15, 2017
2 parents 4a6a893 + 533658f commit 35f14fa
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/vue-instantsearch/src/components/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ export default {
},
destroyed() {
this.searchStore.stop();
this.searchStore.removeFacet(this.attribute);
this.searchStore.start();
},
};
</script>
2 changes: 2 additions & 0 deletions packages/vue-instantsearch/src/components/RangeInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ export default {
},
destroyed() {
this.searchStore.stop();
this.searchStore.removeFacet(this.attributeName);
this.searchStore.start();
},
computed: {
Expand Down
2 changes: 2 additions & 0 deletions packages/vue-instantsearch/src/components/Rating.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ export default {
this.searchStore.addFacet(this.attributeName, FACET_OR);
},
destroyed() {
this.searchStore.stop();
this.searchStore.removeFacet(this.attributeName);
this.searchStore.start();
},
computed: {
show() {
Expand Down
2 changes: 2 additions & 0 deletions packages/vue-instantsearch/src/components/RefinementList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ export default {
this.searchStore.addFacet(this.attributeName, this.operator);
},
destroyed() {
this.searchStore.stop();
this.searchStore.removeFacet(this.attributeName);
this.searchStore.start();
},
computed: {
facetValues() {
Expand Down
2 changes: 2 additions & 0 deletions packages/vue-instantsearch/src/components/TreeMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ export default {
);
},
destroyed() {
this.searchStore.stop();
this.searchStore.removeFacet(this.attribute);
this.searchStore.start();
},
computed: {
facetValues() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ const addFacet = jest.fn();
const searchStore = {
getFacetValues,
addFacet,
stop: () => {},
start: () => {},
};

test('renders proper HTML', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const addFacet = jest.fn();
const searchStore = {
getFacetValues,
addFacet,
stop: () => {},
start: () => {},
};

test('renders proper HTML', () => {
Expand Down

0 comments on commit 35f14fa

Please sign in to comment.