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: duplicate request (#15437)
ecmadaobc18e14be8b6
diff --git a/frontend/src/store/modules/v1/database.ts b/frontend/src/store/modules/v1/database.tsindex b8c72aee04..8d074cc8b8 100644--- a/frontend/src/store/modules/v1/database.ts+++ b/frontend/src/store/modules/v1/database.ts@@ -58,6 +58,7 @@ const formatListDatabaseParent = async (export const useDatabaseV1Store = defineStore("database_v1", () => {const databaseMapByName = reactive(new Map<string, ComposedDatabase>());const dbSchemaStore = useDBSchemaV1Store();+ const databaseRequestCache = new Map<string, Promise<ComposedDatabase>>();// Gettersconst databaseList = computed(() => {@@ -160,7 +161,7 @@ export const useDatabaseV1Store = defineStore("database_v1", () => {return composed;};- const getOrFetchDatabaseByName = async (name: string, silent = false) => {+ const getOrFetchDatabaseByName = async (name: string, silent = true) => {const existed = databaseMapByName.get(name);if (existed) {return existed;@@ -168,7 +169,11 @@ export const useDatabaseV1Store = defineStore("database_v1", () => {if (!isValidDatabaseName(name)) {return unknownDatabase();}- return await fetchDatabaseByName(name, silent);+ const cached = databaseRequestCache.get(name);+ if (cached) return cached;+ const request = fetchDatabaseByName(name, silent);+ databaseRequestCache.set(name, request);+ return request;};const batchUpdateDatabases = async (params: BatchUpdateDatabasesRequest) => {const updated = await databaseServiceClient.batchUpdateDatabases(params);@@ -233,8 +238,6 @@ export const useDatabaseV1ByName = (name: MaybeRef<string>) => {};};-const databaseRequestCache = new Map<string, Promise<ComposedDatabase>>();-export const batchGetOrFetchDatabases = async (databaseNames: string[]) => {const store = useDatabaseV1Store();@@ -244,15 +247,7 @@ export const batchGetOrFetchDatabases = async (databaseNames: string[]) => {if (!databaseName || !isValidDatabaseName(databaseName)) {return;}- const cached = databaseRequestCache.get(databaseName);- if (cached) return cached;-- const request = store.getOrFetchDatabaseByName(- databaseName,- true /* silent */- );- databaseRequestCache.set(databaseName, request);- return request;+ return store.getOrFetchDatabaseByName(databaseName, true /* silent */);}));};diff --git a/frontend/src/store/modules/v1/project.ts b/frontend/src/store/modules/v1/project.tsindex 7a64ec9614..027d4b0625 100644--- a/frontend/src/store/modules/v1/project.ts+++ b/frontend/src/store/modules/v1/project.ts@@ -23,6 +23,7 @@ import { useProjectIamPolicyStore } from "./projectIamPolicy";export const useProjectV1Store = defineStore("project_v1", () => {const projectMapByName = reactive(new Map<ResourceId, ComposedProject>());+ const projectRequestCache = new Map<string, Promise<ComposedProject>>();const reset = () => {projectMapByName.clear();@@ -109,7 +110,7 @@ export const useProjectV1Store = defineStore("project_v1", () => {return await upsertProjectMap(projects);};- const getOrFetchProjectByName = async (name: string, silent = false) => {+ const getOrFetchProjectByName = async (name: string, silent = true) => {const cachedData = getProjectByName(name);if (cachedData && cachedData.name !== UNKNOWN_PROJECT_NAME) {return cachedData;@@ -117,7 +118,11 @@ export const useProjectV1Store = defineStore("project_v1", () => {if (!isValidProjectName(name)) {return unknownProject();}- return fetchProjectByName(name, silent);+ const cached = projectRequestCache.get(name);+ if (cached) return cached;+ const request = fetchProjectByName(name, silent);+ projectRequestCache.set(name, request);+ return request;};const createProject = async (project: Project, resourceId: string) => {const created = await projectServiceClient.createProject({@@ -233,8 +238,6 @@ const batchComposeProjectIamPolicy = async (projectList: Project[]) => {});};-const projectRequestCache = new Map<string, Promise<ComposedProject>>();-export const batchGetOrFetchProjects = async (projectNames: string[]) => {const store = useProjectV1Store();@@ -248,14 +251,7 @@ export const batchGetOrFetchProjects = async (projectNames: string[]) => {) {return;}- const cached = projectRequestCache.get(projectName);- if (cached) return cached;- const request = store.getOrFetchProjectByName(- projectName,- true /* silent */- );- projectRequestCache.set(projectName, request);- return request;+ return store.getOrFetchProjectByName(projectName, true /* silent */);}));};diff --git a/frontend/src/store/modules/v1/projectIamPolicy.ts b/frontend/src/store/modules/v1/projectIamPolicy.tsindex ebb2ffa11b..32cb102b07 100644--- a/frontend/src/store/modules/v1/projectIamPolicy.ts+++ b/frontend/src/store/modules/v1/projectIamPolicy.ts@@ -10,8 +10,8 @@ import {type QueryPermission,} from "@/types";import type { Expr } from "@/types/proto/google/api/expr/v1alpha1/syntax";-import type { User } from "@/types/proto/v1/user_service";import { IamPolicy } from "@/types/proto/v1/iam_policy";+import type { User } from "@/types/proto/v1/user_service";import { getUserEmailListInBinding } from "@/utils";import { convertFromExpr } from "@/utils/issue/cel";import { useCurrentUserV1 } from "../auth";