update group sidebar instances when fetching instance

This commit is contained in:
Natsumi
2025-07-29 17:48:55 +12:00
parent ab1529a800
commit 153d4d4a8a
2 changed files with 10 additions and 5 deletions

View File

@@ -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
});
}
}

View File

@@ -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;
}