Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: refresh user after updating (#4982)
boojack76f254207d4e
diff --git a/frontend/src/store/modules/principal.ts b/frontend/src/store/modules/principal.tsindex 5bd1d9e8b9..28d0db32fc 100644--- a/frontend/src/store/modules/principal.ts+++ b/frontend/src/store/modules/principal.ts@@ -16,6 +16,7 @@ import {} from "@/types";import { randomString } from "@/utils";import { useAuthStore } from "./auth";+import { getUserNameWithUserId } from "./user";function convert(principal: ResourceObject): Principal {return {@@ -145,7 +146,9 @@ export const usePrincipalStore = defineStore("principal", {this.upsertPrincipalInList(updatedPrincipal);- useAuthStore().refreshUserIfNeeded(updatedPrincipal.id);+ await useAuthStore().refreshUserIfNeeded(+ getUserNameWithUserId(updatedPrincipal.id as number)+ );return updatedPrincipal;},diff --git a/frontend/src/store/modules/user.ts b/frontend/src/store/modules/user.tsindex 87fc744bf6..538ba97a26 100644--- a/frontend/src/store/modules/user.ts+++ b/frontend/src/store/modules/user.ts@@ -68,16 +68,18 @@ export const useUserStore = defineStore("user", {return this.userMapByName.get(name);},async getOrFetchUserById(id: number) {- const name = `${userNamePrefix}${id}`;- return await this.getOrFetchUserByName(name);+ return await this.getOrFetchUserByName(getUserNameWithUserId(id));},getUserById(id: number) {- const name = `${userNamePrefix}${id}`;- return this.userMapByName.get(name);+ return this.userMapByName.get(getUserNameWithUserId(id));},},});+export const getUserNameWithUserId = (userId: number) => {+ return `${userNamePrefix}${userId}`;+};+const getUpdateMaskFromUsers = (origin: User,update: Partial<User>diff --git a/frontend/src/views/ProfileDashboard.vue b/frontend/src/views/ProfileDashboard.vueindex 8e08104a76..2a152180e6 100644--- a/frontend/src/views/ProfileDashboard.vue+++ b/frontend/src/views/ProfileDashboard.vue@@ -185,24 +185,11 @@</template><script lang="ts" setup>-import {- nextTick,- computed,- onMounted,- onUnmounted,- reactive,- ref,- watch,-} from "vue";+import { nextTick, computed, onMounted, onUnmounted, reactive, ref } from "vue";import { cloneDeep, isEmpty, isEqual } from "lodash-es";import { PrincipalPatch } from "../types";import { hasWorkspacePermission } from "../utils";-import {- featureToRef,- useCurrentUser,- usePrincipalStore,- useUserStore,-} from "@/store";+import { featureToRef, useCurrentUser, usePrincipalStore } from "@/store";import PrincipalAvatar from "../components/PrincipalAvatar.vue";interface LocalState {@@ -217,7 +204,6 @@ const props = defineProps<{const currentUser = useCurrentUser();const principalStore = usePrincipalStore();-const userStore = useUserStore();const state = reactive<LocalState>({editing: false,});@@ -301,23 +287,12 @@ const cancelEdit = () => {state.editing = false;};-const saveEdit = () => {- principalStore- .patchPrincipal({- principalId: principal.value.id,- principalPatch: state.editingPrincipal!,- })- .then(() => {- state.editingPrincipal = undefined;- state.editing = false;- });+const saveEdit = async () => {+ await principalStore.patchPrincipal({+ principalId: principal.value.id,+ principalPatch: state.editingPrincipal!,+ });+ state.editingPrincipal = undefined;+ state.editing = false;};--watch(- principal,- async () => {- await userStore.fetchUser(`users/${principal.value.id}`);- },- { immediate: true }-);</script>