From 2807ddcd0dcd577fdf259cef92c8cbb419b0d7e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=95=E0=A4=BE=E0=A4=B0=E0=A4=A4=E0=A5=8B=E0=A4=AB?= =?UTF-8?q?=E0=A5=8D=E0=A4=AB=E0=A5=87=E0=A4=B2=E0=A4=B8=E0=A5=8D=E0=A4=95?= =?UTF-8?q?=E0=A5=8D=E0=A4=B0=E0=A4=BF=E0=A4=AA=E0=A5=8D=E0=A4=9F=E2=84=A2?= Date: Mon, 27 Nov 2023 12:48:48 +0100 Subject: [PATCH] fix(editor): Setup push connection in NodeView (no-changelog) (#7821) --- packages/editor-ui/src/App.vue | 3 --- packages/editor-ui/src/stores/pushConnection.store.ts | 1 + packages/editor-ui/src/views/NodeView.vue | 11 +++++++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/editor-ui/src/App.vue b/packages/editor-ui/src/App.vue index aba2c0e8d..1ee26df2d 100644 --- a/packages/editor-ui/src/App.vue +++ b/packages/editor-ui/src/App.vue @@ -56,7 +56,6 @@ import { useCloudPlanStore, useSourceControlStore, useUsageStore, - usePushConnectionStore, } from '@/stores'; import { useHistoryHelper } from '@/composables/useHistoryHelper'; import { useRoute } from 'vue-router'; @@ -93,7 +92,6 @@ export default defineComponent({ useSourceControlStore, useCloudPlanStore, useUsageStore, - usePushConnectionStore, ), defaultLocale(): string { return this.rootStore.defaultLocale; @@ -122,7 +120,6 @@ export default defineComponent({ void initializeAuthenticatedFeatures(); void runExternalHook('app.mount'); - this.pushStore.pushConnect(); this.loading = false; }, watch: { diff --git a/packages/editor-ui/src/stores/pushConnection.store.ts b/packages/editor-ui/src/stores/pushConnection.store.ts index cb199d26b..e7a2f68bc 100644 --- a/packages/editor-ui/src/stores/pushConnection.store.ts +++ b/packages/editor-ui/src/stores/pushConnection.store.ts @@ -149,6 +149,7 @@ export const usePushConnectionStore = defineStore(STORES.PUSH, () => { isConnectionOpen, addEventListener, pushConnect, + pushDisconnect, send, }; }); diff --git a/packages/editor-ui/src/views/NodeView.vue b/packages/editor-ui/src/views/NodeView.vue index 94c3c0317..bb72c700f 100644 --- a/packages/editor-ui/src/views/NodeView.vue +++ b/packages/editor-ui/src/views/NodeView.vue @@ -331,6 +331,7 @@ import { useHistoryStore, useExternalSecretsStore, useCollaborationStore, + usePushConnectionStore, } from '@/stores'; import * as NodeViewUtils from '@/utils/nodeViewUtils'; import { getAccountAge, getConnectionInfo, getNodeViewTab } from '@/utils'; @@ -560,6 +561,7 @@ export default defineComponent({ useHistoryStore, useExternalSecretsStore, useCollaborationStore, + usePushConnectionStore, ), nativelyNumberSuffixedDefaults(): string[] { return this.nodeTypesStore.nativelyNumberSuffixedDefaults; @@ -4674,6 +4676,11 @@ export default defineComponent({ dataPinningEventBus.off('unpin-data', this.removePinDataConnections); nodeViewEventBus.off('saveWorkflow', this.saveCurrentWorkflowExternal); }, + beforeMount() { + if (!this.isDemo) { + this.pushStore.pushConnect(); + } + }, beforeUnmount() { // Make sure the event listeners get removed again else we // could add up with them registered multiple times @@ -4681,6 +4688,10 @@ export default defineComponent({ document.removeEventListener('keyup', this.keyUp); this.unregisterCustomAction('showNodeCreator'); + if (!this.isDemo) { + this.pushStore.pushDisconnect(); + } + this.resetWorkspace(); this.instance.unbind(); this.instance.destroy();