From 153d4d4a8adc2b5221897f50f6bf9e9248682168 Mon Sep 17 00:00:00 2001 From: Natsumi Date: Tue, 29 Jul 2025 17:48:55 +1200 Subject: [PATCH] update group sidebar instances when fetching instance --- src/stores/group.js | 10 +++++----- src/stores/instance.js | 5 +++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/stores/group.js b/src/stores/group.js index 1f25fd21..357b5ad7 100644 --- a/src/stores/group.js +++ b/src/stores/group.js @@ -852,9 +852,9 @@ export const useGroupStore = defineStore('Group', () => { // tack on fetchedAt json.$fetchedAt = args.json.fetchedAt; } - instanceStore.applyInstance(json); - const ref = state.cachedGroups.get(json.ownerId); - if (typeof ref === 'undefined') { + const instanceRef = instanceStore.applyInstance(json); + const groupRef = state.cachedGroups.get(json.ownerId); + if (typeof groupRef === 'undefined') { if (watchState.isFriendsLoaded) { const args = await groupRequest.getGroup({ groupId: json.ownerId @@ -864,8 +864,8 @@ export const useGroupStore = defineStore('Group', () => { return; } state.groupInstances.push({ - group: ref, - instance: instanceStore.applyInstance(json) + group: groupRef, + instance: instanceRef }); } } diff --git a/src/stores/instance.js b/src/stores/instance.js index 1ae95023..0e528821 100644 --- a/src/stores/instance.js +++ b/src/stores/instance.js @@ -416,6 +416,11 @@ export const useInstanceStore = defineStore('Instance', () => { ) { applyGroupDialogInstances(); } + for (const groupInstance of groupStore.groupInstances) { + if (groupInstance.instance.id === ref.id) { + groupInstance.instance = ref; + } + } return ref; }