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

Commit

Permalink
Merge pull request #359 from algolia/stop-store-before-removing-facets
Browse files Browse the repository at this point in the history
fix: avoid query when components are destroyed
  • Loading branch information
rayrutjes authored Nov 15, 2017
2 parents 8182d71 + 95dfad5 commit 644fc13
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions 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 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 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 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 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
2 changes: 2 additions & 0 deletions src/components/__tests__/menu-tree.js
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
2 changes: 2 additions & 0 deletions src/components/__tests__/refinement-list.js
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 644fc13

Please sign in to comment.