From 2f1da19916b6984186e06b6a8856b27842846c6e 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: Thu, 20 Apr 2023 11:20:48 +0200 Subject: [PATCH 1/3] fix(editor): SettingsSidebar should disconnect from push when navigating away --- packages/editor-ui/src/components/SettingsSidebar.vue | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/editor-ui/src/components/SettingsSidebar.vue b/packages/editor-ui/src/components/SettingsSidebar.vue index 8b4676b9eb696..29df3e0def953 100644 --- a/packages/editor-ui/src/components/SettingsSidebar.vue +++ b/packages/editor-ui/src/components/SettingsSidebar.vue @@ -137,6 +137,9 @@ export default mixins(userHelpers, pushConnection).extend({ mounted() { this.pushConnect(); }, + beforeDestroy() { + this.pushDisconnect(); + }, methods: { canAccessPersonalSettings(): boolean { return this.canUserAccessRouteByName(VIEWS.PERSONAL_SETTINGS); From 214d1ad55e7661c3aee08ebb688064d010b53ef0 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: Thu, 20 Apr 2023 11:21:15 +0200 Subject: [PATCH 2/3] SettingsSidebar should use push only if the community nodes feature is enabled --- packages/editor-ui/src/components/SettingsSidebar.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/editor-ui/src/components/SettingsSidebar.vue b/packages/editor-ui/src/components/SettingsSidebar.vue index 29df3e0def953..1af97657a2ed9 100644 --- a/packages/editor-ui/src/components/SettingsSidebar.vue +++ b/packages/editor-ui/src/components/SettingsSidebar.vue @@ -135,10 +135,14 @@ export default mixins(userHelpers, pushConnection).extend({ }, }, mounted() { - this.pushConnect(); + if (this.settingsStore.isCommunityNodesFeatureEnabled) { + this.pushConnect(); + } }, beforeDestroy() { - this.pushDisconnect(); + if (this.settingsStore.isCommunityNodesFeatureEnabled) { + this.pushDisconnect(); + } }, methods: { canAccessPersonalSettings(): boolean { From c581c2bcfbe7ef591ec59abe587f6700ef67f221 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: Thu, 20 Apr 2023 11:32:50 +0200 Subject: [PATCH 3/3] move push handling to SettingsCommunityNodesView --- .../editor-ui/src/components/SettingsSidebar.vue | 13 +------------ .../src/views/SettingsCommunityNodesView.vue | 9 ++++++++- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/packages/editor-ui/src/components/SettingsSidebar.vue b/packages/editor-ui/src/components/SettingsSidebar.vue index 1af97657a2ed9..eb3c3628fb927 100644 --- a/packages/editor-ui/src/components/SettingsSidebar.vue +++ b/packages/editor-ui/src/components/SettingsSidebar.vue @@ -24,7 +24,6 @@ import mixins from 'vue-typed-mixins'; import { ABOUT_MODAL_KEY, VERSIONS_MODAL_KEY, VIEWS } from '@/constants'; import { userHelpers } from '@/mixins/userHelpers'; -import { pushConnection } from '@/mixins/pushConnection'; import { IFakeDoor } from '@/Interface'; import { IMenuItem } from 'n8n-design-system'; import { BaseTextKey } from '@/plugins/i18n'; @@ -33,7 +32,7 @@ import { useUIStore } from '@/stores/ui'; import { useSettingsStore } from '@/stores/settings'; import { useRootStore } from '@/stores/n8nRootStore'; -export default mixins(userHelpers, pushConnection).extend({ +export default mixins(userHelpers).extend({ name: 'SettingsSidebar', computed: { ...mapStores(useRootStore, useSettingsStore, useUIStore), @@ -134,16 +133,6 @@ export default mixins(userHelpers, pushConnection).extend({ return menuItems; }, }, - mounted() { - if (this.settingsStore.isCommunityNodesFeatureEnabled) { - this.pushConnect(); - } - }, - beforeDestroy() { - if (this.settingsStore.isCommunityNodesFeatureEnabled) { - this.pushDisconnect(); - } - }, methods: { canAccessPersonalSettings(): boolean { return this.canUserAccessRouteByName(VIEWS.PERSONAL_SETTINGS); diff --git a/packages/editor-ui/src/views/SettingsCommunityNodesView.vue b/packages/editor-ui/src/views/SettingsCommunityNodesView.vue index d67426dd9b558..c6e4dbfd6d9c4 100644 --- a/packages/editor-ui/src/views/SettingsCommunityNodesView.vue +++ b/packages/editor-ui/src/views/SettingsCommunityNodesView.vue @@ -59,6 +59,7 @@ import { } from '@/constants'; import CommunityPackageCard from '@/components/CommunityPackageCard.vue'; import { showMessage } from '@/mixins/showMessage'; +import { pushConnection } from '@/mixins/pushConnection'; import mixins from 'vue-typed-mixins'; import { PublicInstalledPackage } from 'n8n-workflow'; @@ -70,7 +71,7 @@ import { BaseTextKey } from '@/plugins/i18n'; const PACKAGE_COUNT_THRESHOLD = 31; -export default mixins(showMessage).extend({ +export default mixins(showMessage, pushConnection).extend({ name: 'SettingsCommunityNodesView', components: { CommunityPackageCard, @@ -81,6 +82,9 @@ export default mixins(showMessage).extend({ }; }, async mounted() { + // The push connection is needed here to receive `reloadNodeType` and `removeNodeType` events when community nodes are installed, updated, or removed. + this.pushConnect(); + try { this.$data.loading = true; await this.communityNodesStore.fetchInstalledPackages(); @@ -124,6 +128,9 @@ export default mixins(showMessage).extend({ this.$data.loading = false; } }, + beforeDestroy() { + this.pushDisconnect(); + }, computed: { ...mapStores(useCommunityNodesStore, useSettingsStore, useUIStore), getEmptyStateDescription(): string {