From f17bbeddeccfb29085ad606de58f665a9fd48493 Mon Sep 17 00:00:00 2001 From: kolaente Date: Mon, 24 Oct 2022 18:56:50 +0200 Subject: [PATCH] fix(subscription): don't remove every namespace but the one subscribing to --- .../namespace/namespace-settings-dropdown.vue | 10 ++++------ src/stores/namespaces.ts | 7 +++++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/components/namespace/namespace-settings-dropdown.vue b/src/components/namespace/namespace-settings-dropdown.vue index fb71ba66a..e5381cac1 100644 --- a/src/components/namespace/namespace-settings-dropdown.vue +++ b/src/components/namespace/namespace-settings-dropdown.vue @@ -79,11 +79,9 @@ onMounted(() => { function setSubscriptionInStore(sub: ISubscription) { subscription.value = sub - namespaceStore.setNamespaces([ - { - ...props.namespace, - subscription: sub, - }, - ]) + namespaceStore.setNamespaceById({ + ...props.namespace, + subscription: sub, + }) } diff --git a/src/stores/namespaces.ts b/src/stores/namespaces.ts index 5d83948ba..913c37efa 100644 --- a/src/stores/namespaces.ts +++ b/src/stores/namespaces.ts @@ -84,6 +84,13 @@ export const useNamespaceStore = defineStore('namespace', { if (!namespace.lists || namespace.lists.length === 0) { namespace.lists = this.namespaces[namespaceIndex].lists } + + // Check for each list in that namespace if it has a subscription and set it if not + namespace.lists.forEach(l => { + if (l.subscription === null || l.subscription.entity !== 'list') { + l.subscription = namespace.subscription + } + }) this.namespaces[namespaceIndex] = namespace update(namespace)