From 7b505e0241152913d9dde86c4641f8390fe22ee2 Mon Sep 17 00:00:00 2001 From: Jonathon Broughton Date: Sun, 5 Jun 2022 11:44:27 +0100 Subject: [PATCH] Calling $on for $eventHub conditional on its presence. This code on the mount event for this component when using the embedded viewer on a page is very noisy with respect to $eventHub seemingly being not present on the Vue instance, or at least not at the time of mounting. --- .../src/main/components/viewer/ViewerFilters.vue | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/frontend/src/main/components/viewer/ViewerFilters.vue b/packages/frontend/src/main/components/viewer/ViewerFilters.vue index d77d6b714..66511cf22 100644 --- a/packages/frontend/src/main/components/viewer/ViewerFilters.vue +++ b/packages/frontend/src/main/components/viewer/ViewerFilters.vue @@ -164,12 +164,14 @@ export default { if (this.props) { this.parseAndSetFilters() } - this.$eventHub.$on('structure-filters', () => { - this.activeFilter = null - }) - this.$eventHub.$on('selection-filters', () => { - this.activeFilter = null - }) + if (this.$eventHub) { + this.$eventHub.$on('structure-filters', () => { + this.activeFilter = null + }) + this.$eventHub.$on('selection-filters', () => { + this.activeFilter = null + }) + } }, methods: { parseAndSetFilters() {