From 51273f5217658665b7bbd8a3504cd1ff4ad40e00 Mon Sep 17 00:00:00 2001 From: Jannik Stehle Date: Tue, 18 Jun 2024 14:34:12 +0200 Subject: [PATCH] fix: updating admin-settings ui after saving changes --- .../unreleased/bugfix-admin-settings-ui-update-after-save | 6 ++++++ .../src/composables/stores/groupSettings.ts | 4 ++-- .../src/composables/stores/spaceSettings.ts | 2 +- .../src/composables/stores/userSettings.ts | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 changelog/unreleased/bugfix-admin-settings-ui-update-after-save diff --git a/changelog/unreleased/bugfix-admin-settings-ui-update-after-save b/changelog/unreleased/bugfix-admin-settings-ui-update-after-save new file mode 100644 index 00000000000..31ced4be32c --- /dev/null +++ b/changelog/unreleased/bugfix-admin-settings-ui-update-after-save @@ -0,0 +1,6 @@ +Bugfix: Admin settings UI update after save + +We've fixed a bug where the UI would not display changes made in the admin settings until re-loading the entire page. + +https://github.com/owncloud/web/pull/11059 +https://github.com/owncloud/web/issues/11033 diff --git a/packages/web-app-admin-settings/src/composables/stores/groupSettings.ts b/packages/web-app-admin-settings/src/composables/stores/groupSettings.ts index cd2d4b4af83..3d7653ad050 100644 --- a/packages/web-app-admin-settings/src/composables/stores/groupSettings.ts +++ b/packages/web-app-admin-settings/src/composables/stores/groupSettings.ts @@ -11,9 +11,9 @@ export const useGroupSettingsStore = defineStore('groupSettings', () => { } const upsertGroup = (group: Group) => { - const existing = unref(groups).some(({ id }) => id === group.id) + const existing = unref(groups).find(({ id }) => id === group.id) if (existing) { - Object.assign(existing, { ...group, members: [] }) + Object.assign(existing, group) return } unref(groups).push({ ...group, members: [] }) diff --git a/packages/web-app-admin-settings/src/composables/stores/spaceSettings.ts b/packages/web-app-admin-settings/src/composables/stores/spaceSettings.ts index ba3b288ed4a..75b3827d8e6 100644 --- a/packages/web-app-admin-settings/src/composables/stores/spaceSettings.ts +++ b/packages/web-app-admin-settings/src/composables/stores/spaceSettings.ts @@ -11,7 +11,7 @@ export const useSpaceSettingsStore = defineStore('spaceSettings', () => { } const upsertSpace = (space: SpaceResource) => { - const existing = unref(spaces).some(({ id }) => id === space.id) + const existing = unref(spaces).find(({ id }) => id === space.id) if (existing) { Object.assign(existing, space) return diff --git a/packages/web-app-admin-settings/src/composables/stores/userSettings.ts b/packages/web-app-admin-settings/src/composables/stores/userSettings.ts index d9c50802299..a8c2da46885 100644 --- a/packages/web-app-admin-settings/src/composables/stores/userSettings.ts +++ b/packages/web-app-admin-settings/src/composables/stores/userSettings.ts @@ -11,7 +11,7 @@ export const useUserSettingsStore = defineStore('userSettings', () => { } const upsertUser = (user: User) => { - const existing = unref(users).some(({ id }) => id === user.id) + const existing = unref(users).find(({ id }) => id === user.id) if (existing) { Object.assign(existing, user) return