From 4149a498079bfd3c96a3185eca1231e0f448c1bd Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Wed, 27 Nov 2019 11:09:02 +0000 Subject: [PATCH] Unwatch store before destroy --- src/components/viewComponents/galleryDisplay.vue | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/viewComponents/galleryDisplay.vue b/src/components/viewComponents/galleryDisplay.vue index 85a02f16..38c90ebc 100644 --- a/src/components/viewComponents/galleryDisplay.vue +++ b/src/components/viewComponents/galleryDisplay.vue @@ -107,7 +107,8 @@ export default { checkedTags: [], sortDescending: true, galleryFolder: "", - scanTag: "scan" + scanTag: "scan", + unwatchStoreFunction: null }; }, @@ -243,7 +244,7 @@ export default { created: function() { // Watch for host 'ready', then update status - this.$store.watch( + this.unwatchStoreFunction = this.$store.watch( (state, getters) => { return getters.ready; }, @@ -259,6 +260,14 @@ export default { ); }, + beforeDestroy() { + // Then we call that function here to unwatch + if (this.unwatchStoreFunction) { + this.unwatchStoreFunction(); + this.unwatchStoreFunction = null; + } + }, + methods: { updateCaptureList: function() { console.log("Updating capture list...");