Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
refactor: implement store list cache for projects/instances (#13199)
boojack5e7a3b3ba126
diff --git a/frontend/src/components/AdvancedSearch/useCommonSearchScopeOptions.ts b/frontend/src/components/AdvancedSearch/useCommonSearchScopeOptions.tsindex 86b0f112fc..fa9ac8f0dc 100644--- a/frontend/src/components/AdvancedSearch/useCommonSearchScopeOptions.ts+++ b/frontend/src/components/AdvancedSearch/useCommonSearchScopeOptions.ts@@ -14,8 +14,8 @@ import {useDatabaseV1Store,useDatabaseV1ListByProject,useEnvironmentV1List,- useProjectV1List,useEnvironmentV1Store,+ useProjectV1Store,} from "@/store";import { UNKNOWN_ID, type MaybeRef } from "@/types";import { engineToJSON } from "@/types/proto/v1/common";@@ -38,7 +38,7 @@ export const useCommonSearchScopeOptions = (const databaseV1Store = useDatabaseV1Store();const environmentStore = useEnvironmentV1Store();const environmentList = useEnvironmentV1List(false /* !showDeleted */);- const { projectList } = useProjectV1List();+ const projectList = useProjectV1Store().projectList;const project = computed(() => {const { projectId } = route.params;@@ -61,7 +61,7 @@ export const useCommonSearchScopeOptions = (id: "project",title: t("issue.advanced-search.scope.project.title"),description: t("issue.advanced-search.scope.project.description"),- options: projectList.value.map<ValueOption>((proj) => {+ options: projectList.map<ValueOption>((proj) => {const name = extractProjectResourceName(proj.name);return {value: name,diff --git a/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepForm.vue b/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepForm.vueindex 512e38aad6..e00946fe68 100644--- a/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepForm.vue+++ b/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepForm.vue@@ -225,7 +225,8 @@ const emit = defineEmits<{const router = useRouter();const currentUserV1 = useCurrentUserV1();const projectV1Store = useProjectV1Store();-useInstanceV1List(false /** showDeleted */);+// Prepare instance list.+useInstanceV1List();const state = reactive<LocalState>({databaseName: "",diff --git a/frontend/src/components/ProvideDashboardContext.vue b/frontend/src/components/ProvideDashboardContext.vueindex a572f504c7..6eb7d60b9d 100644--- a/frontend/src/components/ProvideDashboardContext.vue+++ b/frontend/src/components/ProvideDashboardContext.vue@@ -21,6 +21,7 @@ import {AUTH_SIGNIN_MODULE,AUTH_SIGNUP_MODULE,} from "@/router/auth";+import { PROJECT_V1_ROUTE_DASHBOARD } from "@/router/dashboard/workspaceRoutes";import {useEnvironmentV1Store,usePolicyV1Store,@@ -31,6 +32,7 @@ import {useUIStateStore,useDatabaseV1Store,useGroupStore,+ useProjectV1List,} from "@/store";import { projectNamePrefix } from "@/store/modules/v1/common";import { PolicyResourceType } from "@/types/proto/v1/org_policy_service";@@ -44,6 +46,15 @@ const isSwitchingProject = ref(false);const policyStore = usePolicyV1Store();const databaseStore = useDatabaseV1Store();+const prepareProjects = async () => {+ const routeName = route.name?.toString() || "";+ if (!routeName.startsWith(PROJECT_V1_ROUTE_DASHBOARD)) {+ await useProjectV1Store().listProjects();+ } else {+ // We will handle GetProject in `ProjectV1Layout.vue`.+ }+};+const fetchDatabases = async (optionalProject: string) => {const filters = [`instance = "instances/-"`];// If `projectId` is provided in the route, filter the database list by the project.@@ -56,7 +67,7 @@ const fetchDatabases = async (optionalProject: string) => {};const databaseInitialized = new Set<string /* project */>();-const fetchInstancesAndDatabases = async (optionalProject: string) => {+const prepareDatabases = async (optionalProject: string) => {if (databaseInitialized.has(optionalProject || "")) return;try {await Promise.all([fetchDatabases(optionalProject)]);@@ -84,14 +95,15 @@ onMounted(async () => {useUserStore().fetchUserList(),useGroupStore().fetchGroupList(),useEnvironmentV1Store().fetchEnvironments(),- useProjectV1Store().fetchProjectList(true /* showDeleted */),+ prepareProjects(),]);++ await prepareDatabases(route.params.projectId as string);useUIStateStore().restoreState();- await fetchInstancesAndDatabases(route.params.projectId as string);isInitializing.value = false;- unregisterBeforeEachHook = router.beforeEach((to, from, next) => {+ unregisterBeforeEachHook = router.beforeEach(async (to, from, next) => {if (to.name === AUTH_SIGNIN_MODULE ||to.name === AUTH_SIGNUP_MODULE ||@@ -110,12 +122,14 @@ onMounted(async () => {`[ProvideDashboardContext] project switched ${fromProject} -> ${toProject}`);isSwitchingProject.value = true;- fetchInstancesAndDatabases(toProject).finally(() => {- isSwitchingProject.value = false;-- next();- });- return;+ if (toProject === undefined) {+ // Prepare projects if the project is not specified.+ // This is useful when the user navigates to the workspace dashboard from project detail.+ await useProjectV1List().requestPromise.value;+ }+ await prepareDatabases(toProject);+ isSwitchingProject.value = false;+ next();}next();diff --git a/frontend/src/components/ProvideSQLEditorContext.vue b/frontend/src/components/ProvideSQLEditorContext.vueindex 8181aa0c7f..5ea331f488 100644--- a/frontend/src/components/ProvideSQLEditorContext.vue+++ b/frontend/src/components/ProvideSQLEditorContext.vue@@ -101,7 +101,7 @@ const hideProjects = useAppFeature("bb.feature.sql-editor.hide-projects");const initializeProjects = async () => {const initProject = async (project: string) => {try {- await projectStore.getOrFetchProjectByName(project, /* !silent */ false);+ await projectStore.getOrFetchProjectByName(project);editorStore.project = project;return true;} catch {@@ -131,7 +131,7 @@ const initializeProjects = async () => {editorStore.strictProject = false;await initProject(DEFAULT_PROJECT_NAME);} else {- const projectList = await projectStore.fetchProjectList(false);+ const projectList = await projectStore.listProjects();const lastView = editorStore.storedLastViewedProject;if (lastView &&@@ -159,7 +159,7 @@ const handleProjectSwitched = async () => {if (project) {await projectStore.getOrFetchProjectByName(project, true /* silent */);} else {- await projectStore.fetchProjectList(false /* !showDeleted */);+ await projectStore.listProjects();}tabStore.maybeInitProject(project);};diff --git a/frontend/src/components/QuickActionPanel.vue b/frontend/src/components/QuickActionPanel.vueindex 40ef123025..1ad6b808f0 100644--- a/frontend/src/components/QuickActionPanel.vue+++ b/frontend/src/components/QuickActionPanel.vue@@ -134,7 +134,6 @@ import {useCurrentUserIamPolicy,useSubscriptionV1Store,useProjectV1Store,- useProjectV1List,useInstanceResourceList,} from "@/store";import { projectNamePrefix } from "@/store/modules/v1/common";@@ -207,9 +206,8 @@ const project = computed(() => {// Only show alter schema and change data if the user has permission to alter schema of at least one project.const shouldShowAlterDatabaseEntries = computed(() => {- const { projectList } = useProjectV1List();const currentUserIamPolicy = useCurrentUserIamPolicy();- return projectList.value+ return projectStore.projectList.map((project) => {return currentUserIamPolicy.allowToChangeDatabaseOfProject(project.name);})diff --git a/frontend/src/components/SlowQuery/Settings/SlowQuerySettings.vue b/frontend/src/components/SlowQuery/Settings/SlowQuerySettings.vueindex bbe4c5b4ca..9461954ed2 100644--- a/frontend/src/components/SlowQuery/Settings/SlowQuerySettings.vue+++ b/frontend/src/components/SlowQuery/Settings/SlowQuerySettings.vue@@ -38,7 +38,6 @@ import {pushNotification,useEnvironmentV1List,useEnvironmentV1Store,- useInstanceV1List,useInstanceV1Store,useSlowQueryPolicyStore,useSlowQueryStore,@@ -79,9 +78,7 @@ const policyList = computed(() => {});const instanceList = computed(() => {- return useInstanceV1List(false /* !showDeleted */).instanceList.value.filter(- instanceV1SupportSlowQuery- );+ return instanceV1Store.activeInstanceList.filter(instanceV1SupportSlowQuery);});const composedSlowQueryPolicyList = computed(() => {diff --git a/frontend/src/components/WorkspaceInstanceLicenseStats.vue b/frontend/src/components/WorkspaceInstanceLicenseStats.vueindex 98e9531cf9..6b77046207 100644--- a/frontend/src/components/WorkspaceInstanceLicenseStats.vue+++ b/frontend/src/components/WorkspaceInstanceLicenseStats.vue@@ -52,7 +52,8 @@ const state = reactive<LocalState>({});const subscriptionStore = useSubscriptionV1Store();const instanceV1Store = useInstanceV1Store();-useInstanceV1List(/* showDeleted */ false, /* forceUpdate */ true);+// Prepare instance list.+useInstanceV1List();const { instanceLicenseCount } = storeToRefs(subscriptionStore);diff --git a/frontend/src/components/v2/Select/EnvironmentSelect.vue b/frontend/src/components/v2/Select/EnvironmentSelect.vueindex 56a027784a..b87d11e1d7 100644--- a/frontend/src/components/v2/Select/EnvironmentSelect.vue+++ b/frontend/src/components/v2/Select/EnvironmentSelect.vue@@ -16,8 +16,8 @@<script lang="tsx" setup>import type { SelectOption } from "naive-ui";import { NSelect } from "naive-ui";-import { computed, watchEffect } from "vue";-import { useEnvironmentV1Store, useProjectV1Store } from "@/store";+import { computed } from "vue";+import { useEnvironmentV1Store } from "@/store";import { State } from "@/types/proto/v1/common";import type { Environment } from "@/types/proto/v1/environment_service";import { EnvironmentV1Name } from "../Model";@@ -52,14 +52,8 @@ const emit = defineEmits<{(event: "update:environment-name", name: string | undefined): void;(event: "update:environment-names", names: string[]): void;}>();--const projectV1Store = useProjectV1Store();const environmentV1Store = useEnvironmentV1Store();-const prepare = () => {- projectV1Store.fetchProjectList(true /* showDeleted */);-};-const combinedValue = computed(() => {if (props.multiple) {return props.environmentNames || [];@@ -145,6 +139,4 @@ const filterByName = (pattern: string, option: SelectOption) => {environment.title.toLowerCase().includes(pattern));};--watchEffect(prepare);</script>diff --git a/frontend/src/components/v2/Select/ProjectSelect.vue b/frontend/src/components/v2/Select/ProjectSelect.vueindex c3bbbcc132..638b769da9 100644--- a/frontend/src/components/v2/Select/ProjectSelect.vue+++ b/frontend/src/components/v2/Select/ProjectSelect.vue@@ -19,12 +19,11 @@import { intersection } from "lodash-es";import type { SelectOption } from "naive-ui";import { NSelect } from "naive-ui";-import { computed, watchEffect } from "vue";+import { computed } from "vue";import { useI18n } from "vue-i18n";import { ProjectNameCell } from "@/components/v2/Model/DatabaseV1Table/cells";import {useCurrentUserV1,- useProjectV1Store,useProjectV1List,usePermissionStore,} from "@/store";@@ -81,12 +80,8 @@ const emit = defineEmits<{const { t } = useI18n();const currentUserV1 = useCurrentUserV1();-const projectV1Store = useProjectV1Store();const permissionStore = usePermissionStore();--const prepare = () => {- projectV1Store.fetchProjectList(true /* showDeleted */);-};+const { projectList } = useProjectV1List(true /* showDeleted */);const combinedValue = computed(() => {if (props.multiple) {@@ -116,8 +111,6 @@ const hasWorkspaceManageProjectPermission = computed(() =>hasWorkspacePermissionV2(currentUserV1.value, "bb.projects.list"));-const { projectList } = useProjectV1List();-const rawProjectList = computed(() => {return projectList.value.filter((project) => {if (project.name === DEFAULT_PROJECT_NAME) {@@ -220,8 +213,6 @@ const filterByName = (pattern: string, option: SelectOption) => {);};-watchEffect(prepare);-const renderLabel = (option: SelectOption) => {const { project } = option as ProjectSelectOption;return (diff --git a/frontend/src/layouts/ProjectV1Layout.vue b/frontend/src/layouts/ProjectV1Layout.vueindex 5b266d4758..79c3d27964 100644--- a/frontend/src/layouts/ProjectV1Layout.vue+++ b/frontend/src/layouts/ProjectV1Layout.vue@@ -25,7 +25,7 @@</template><script lang="ts" setup>-import { computed, onMounted, watchEffect } from "vue";+import { computed, watchEffect } from "vue";import { useRoute, useRouter } from "vue-router";import { BBAttention } from "@/bbkit";import ArchiveBanner from "@/components/ArchiveBanner.vue";@@ -36,7 +36,7 @@ import {PROJECT_V1_ROUTE_DATABASES,PROJECT_V1_ROUTE_DATABASE_GROUPS,} from "@/router/dashboard/projectV1";-import { useProjectV1Store, useCurrentUserV1, useAppFeature } from "@/store";+import { useCurrentUserV1, useAppFeature, useProjectByName } from "@/store";import { projectNamePrefix } from "@/store/modules/v1/common";import type { QuickActionType } from "@/types";import { DEFAULT_PROJECT_NAME, QuickActionProjectPermissionMap } from "@/types";@@ -50,16 +50,12 @@ const props = defineProps<{const route = useRoute();const router = useRouter();const currentUserV1 = useCurrentUserV1();-const projectV1Store = useProjectV1Store();const recentProjects = useRecentProjects();const hideQuickAction = useAppFeature("bb.feature.console.hide-quick-action");const hideDefaultProject = useAppFeature("bb.feature.project.hide-default");--const project = computed(() => {- return projectV1Store.getProjectByName(- `${projectNamePrefix}${props.projectId}`- );-});+const { project } = useProjectByName(+ computed(() => `${projectNamePrefix}${props.projectId}`)+);watchEffect(() => {recentProjects.setRecentProject(project.value.name);@@ -95,12 +91,6 @@ const allowEdit = computed(() => {);});-onMounted(async () => {- await projectV1Store.getOrFetchProjectByName(- `${projectNamePrefix}${props.projectId}`- );-});-const getQuickActionList = (list: QuickActionType[]): QuickActionType[] => {return list.filter((action) => {if (!QuickActionProjectPermissionMap.has(action)) {diff --git a/frontend/src/store/modules/v1/cache.ts b/frontend/src/store/modules/v1/cache.tsnew file mode 100644index 0000000000..1621e45363--- /dev/null+++ b/frontend/src/store/modules/v1/cache.ts@@ -0,0 +1,15 @@+export type StoreCache = {+ // The timestamp when the cache was last updated.+ timestamp: number;+ // The flag indicating whether the cache is currently being fetched.+ isFetching: boolean;+};++export const getResourceStoreCacheKey = (+ // The resource type.+ resource: "project" | "instance" | "database",+ // Other attributes to include in the cache key, e.g. "view", "deleted".+ ...attrs: string[]+) => {+ return `${resource}-${attrs.join("-")}`;+};diff --git a/frontend/src/store/modules/v1/instance.ts b/frontend/src/store/modules/v1/instance.tsindex fce609b9b4..ec3ce1d07d 100644--- a/frontend/src/store/modules/v1/instance.ts+++ b/frontend/src/store/modules/v1/instance.ts@@ -1,15 +1,16 @@import { defineStore } from "pinia";-import { computed, reactive, ref, unref, watchEffect } from "vue";+import { computed, reactive, unref, watchEffect } from "vue";import { instanceServiceClient } from "@/grpcweb";import type { ComposedInstance, MaybeRef } from "@/types";import { unknownEnvironment, unknownInstance } from "@/types";import { State } from "@/types/proto/v1/common";import type { DataSource, Instance } from "@/types/proto/v1/instance_service";import { extractInstanceResourceName } from "@/utils";+import { getResourceStoreCacheKey, type StoreCache } from "./cache";import { useEnvironmentV1Store } from "./environment";export const useInstanceV1Store = defineStore("instance_v1", () => {- const listInitialized = ref(false);+ const listCache = reactive(new Map<string, StoreCache>());const instanceMapByName = reactive(new Map<string, ComposedInstance>());const reset = () => {@@ -46,19 +47,25 @@ export const useInstanceV1Store = defineStore("instance_v1", () => {});return composedInstances;};- const listInstances = async (showDeleted = false, force?: boolean) => {- if (!force && listInitialized.value) {- return showDeleted- ? instanceList.value- : instanceList.value.filter(- (instance) => instance.state === State.ACTIVE- );+ const listInstances = async (showDeleted = false) => {+ const cacheKey = getResourceStoreCacheKey(+ "instance",+ showDeleted ? "" : "active"+ );+ if (!listCache.has(cacheKey)) {+ listCache.set(cacheKey, {+ timestamp: Date.now(),+ isFetching: true,+ });}const { instances } = await instanceServiceClient.listInstances({showDeleted,});const composed = await upsertInstances(instances);- listInitialized.value = true;+ listCache.set(cacheKey, {+ timestamp: Date.now(),+ isFetching: false,+ });return composed;};const createInstance = async (instance: Instance) => {@@ -166,7 +173,7 @@ export const useInstanceV1Store = defineStore("instance_v1", () => {return {reset,- listInitialized,+ listCache,instanceList,activeInstanceList,activateInstanceCount,@@ -185,30 +192,36 @@ export const useInstanceV1Store = defineStore("instance_v1", () => {};});-export const useInstanceV1List = (- showDeleted: MaybeRef<boolean> = false,- forceUpdate = false-) => {+export const useInstanceV1List = (showDeleted: MaybeRef<boolean> = false) => {const store = useInstanceV1Store();- const ready = ref(false);+ const cacheKey = getResourceStoreCacheKey(+ "instance",+ showDeleted ? "" : "active"+ );+ const cache = computed(() => store.listCache.get(cacheKey));+watchEffect(() => {- if (!unref(forceUpdate) && store.listInitialized) {- ready.value = true;+ // If request is already in progress, do not send another request.+ if (cache.value?.isFetching) {return;}-- ready.value = false;- store.listInstances(unref(showDeleted)).then(() => {- ready.value = true;- });+ // If cache is available and forceUpdate is false, do not send another request.+ if (cache.value) {+ return;+ }+ store.listInstances(unref(showDeleted));});+const instanceList = computed(() => {if (unref(showDeleted)) {return store.instanceList;}return store.activeInstanceList;});- return { instanceList, ready };+ return {+ instanceList,+ ready: computed(() => cache.value && !cache.value.isFetching),+ };};const composeInstance = async (instance: Instance) => {diff --git a/frontend/src/store/modules/v1/project.ts b/frontend/src/store/modules/v1/project.tsindex 394d09349a..1b9713dff1 100644--- a/frontend/src/store/modules/v1/project.ts+++ b/frontend/src/store/modules/v1/project.ts@@ -17,9 +17,11 @@ import { State } from "@/types/proto/v1/common";import type { Project } from "@/types/proto/v1/project_service";import { hasWorkspacePermissionV2 } from "@/utils";import { useCurrentUserV1 } from "../auth";+import { getResourceStoreCacheKey, type StoreCache } from "./cache";import { useProjectIamPolicyStore } from "./projectIamPolicy";export const useProjectV1Store = defineStore("project_v1", () => {+ const listCache = reactive(new Map<string, StoreCache>());const currentUser = useCurrentUserV1();const projectMapByName = reactive(new Map<ResourceId, ComposedProject>());@@ -40,14 +42,24 @@ export const useProjectV1Store = defineStore("project_v1", () => {const updateProjectCache = (project: ComposedProject) => {projectMapByName.set(project.name, project);};-const upsertProjectMap = async (projectList: Project[]) => {const composedProjectList = await batchComposeProjectIamPolicy(projectList);composedProjectList.forEach((project) => {updateProjectCache(project);});+ return composedProjectList;};- const fetchProjectList = async (showDeleted = false) => {+ const listProjects = async (showDeleted = false) => {+ const cacheKey = getResourceStoreCacheKey(+ "project",+ showDeleted ? "" : "active"+ );+ if (!listCache.has(cacheKey)) {+ listCache.set(cacheKey, {+ timestamp: Date.now(),+ isFetching: true,+ });+ }const request = hasWorkspacePermissionV2(currentUser.value,"bb.projects.list"@@ -55,8 +67,12 @@ export const useProjectV1Store = defineStore("project_v1", () => {? projectServiceClient.listProjects: projectServiceClient.searchProjects;const { projects } = await request({ showDeleted });- await upsertProjectMap(projects);- return projects;+ const composedProjects = await upsertProjectMap(projects);+ listCache.set(cacheKey, {+ timestamp: Date.now(),+ isFetching: false,+ });+ return composedProjects;};const getProjectList = (showDeleted = false) => {if (unref(showDeleted)) {@@ -130,11 +146,13 @@ export const useProjectV1Store = defineStore("project_v1", () => {return {reset,+ listCache,+ projectMapByName,projectList,getProjectList,findProjectByUID,getProjectByName,- fetchProjectList,+ listProjects,getOrFetchProjectByName,createProject,updateProject,@@ -144,26 +162,35 @@ export const useProjectV1Store = defineStore("project_v1", () => {};});-export const useProjectV1List = (- showDeleted: MaybeRef<boolean> = false,- forceUpdate = false-) => {+export const useProjectV1List = (showDeleted: MaybeRef<boolean> = false) => {const store = useProjectV1Store();- const ready = ref(false);+ const cacheKey = getResourceStoreCacheKey(+ "project",+ showDeleted ? "" : "active"+ );+ const cache = computed(() => store.listCache.get(cacheKey));+ const requestPromise = ref<Promise<ComposedProject[]> | null>(null);+watchEffect(() => {- if (!unref(forceUpdate)) {- ready.value = true;+ // If request is already in progress, do not send another request.+ if (cache.value?.isFetching) {return;}- ready.value = false;- store.fetchProjectList(unref(showDeleted)).then(() => {- ready.value = true;- });+ // If cache is available, do not send another request.+ if (cache.value) {+ return;+ }+ requestPromise.value = store.listProjects(unref(showDeleted));});+const projectList = computed(() => {return store.getProjectList(unref(showDeleted));});- return { projectList, ready };+ return {+ projectList,+ ready: computed(() => cache.value && !cache.value.isFetching),+ requestPromise,+ };};export const useProjectByName = (name: MaybeRef<string>) => {diff --git a/frontend/src/views/Archive.vue b/frontend/src/views/Archive.vueindex fbd50217be..1ac7ae243b 100644--- a/frontend/src/views/Archive.vue+++ b/frontend/src/views/Archive.vue@@ -54,7 +54,7 @@ import {useEnvironmentV1Store,useIdentityProviderStore,useInstanceV1Store,- useProjectV1List,+ useProjectV1Store,} from "@/store";import { State } from "@/types/proto/v1/common";import type { IdentityProvider } from "@/types/proto/v1/idp_service";@@ -69,33 +69,38 @@ interface LocalState {}const { t } = useI18n();+const environmentStore = useEnvironmentV1Store();+const projectStore = useProjectV1Store();const instanceStore = useInstanceV1Store();-+const currentUserV1 = useCurrentUserV1();const state = reactive<LocalState>({selectedTab: "PROJECT",searchText: "",});-const currentUserV1 = useCurrentUserV1();--const { projectList } = useProjectV1List(true /* showDeleted */);-const prepareList = () => {+ environmentStore.fetchEnvironments(true /* showDeleted */);+ projectStore.listProjects(true /* showDeleted */);instanceStore.listInstances(true /* showDeleted */);- useEnvironmentV1Store().fetchEnvironments(true /* showDeleted */);};watchEffect(prepareList);+const environmentList = computed(() => {+ return environmentStore.environmentList.filter(+ (env) => env.state === State.DELETED+ );+});+const instanceList = computed(() => {return instanceStore.instanceList.filter((instance) => instance.state === State.DELETED);});-const environmentList = computed(() => {- return useEnvironmentV1Store().environmentList.filter(- (env) => env.state === State.DELETED+const projectList = computed(() => {+ return projectStore.projectList.filter(+ (project) => project.state === State.DELETED);});diff --git a/frontend/src/views/InstanceDashboard.vue b/frontend/src/views/InstanceDashboard.vueindex 358724c462..d7f248790e 100644--- a/frontend/src/views/InstanceDashboard.vue+++ b/frontend/src/views/InstanceDashboard.vue@@ -52,9 +52,7 @@ const subscriptionStore = useSubscriptionV1Store();const instanceV1Store = useInstanceV1Store();const uiStateStore = useUIStateStore();const environmentList = useEnvironmentV1List();-const { instanceList: rawInstanceV1List, ready } = useInstanceV1List(- false // showDeleted-);+const { instanceList, ready } = useInstanceV1List();const state = reactive<LocalState>({params: {@@ -85,7 +83,7 @@ onMounted(() => {});const filteredInstanceV1List = computed(() => {- let list = [...rawInstanceV1List.value];+ let list = [...instanceList.value];if (selectedEnvironment.value !== `${UNKNOWN_ID}`) {list = list.filter((instance) =>diff --git a/frontend/src/views/sql-editor/Setting/Instance/Instance.vue b/frontend/src/views/sql-editor/Setting/Instance/Instance.vueindex bbe5a956de..762d8c2456 100644--- a/frontend/src/views/sql-editor/Setting/Instance/Instance.vue+++ b/frontend/src/views/sql-editor/Setting/Instance/Instance.vue@@ -106,9 +106,7 @@ const subscriptionStore = useSubscriptionV1Store();const instanceV1Store = useInstanceV1Store();const environmentList = useEnvironmentV1List();// Users are workspace admins in Bytebase Editor. So we don't need to check permission here.-const { instanceList: rawInstanceV1List, ready } = useInstanceV1List(- /* showDeleted */ false-);+const { instanceList, ready } = useInstanceV1List();const hideAdvancedFeatures = useAppFeature("bb.feature.sql-editor.hide-advance-instance-features");@@ -144,7 +142,7 @@ onMounted(() => {wrapRefAsPromise(ready, true).then(() => {const maybeInstanceName = route.hash.replace(/^#*/g, "");if (maybeInstanceName) {- const instance = rawInstanceV1List.value.find(+ const instance = instanceList.value.find((inst) => inst.name === maybeInstanceName);if (instance) {@@ -167,7 +165,7 @@ onMounted(() => {});const filteredInstanceV1List = computed(() => {- let list = [...rawInstanceV1List.value];+ let list = [...instanceList.value];if (selectedEnvironment.value !== `${UNKNOWN_ID}`) {list = list.filter((instance) =>diff --git a/frontend/src/views/sql-editor/Setting/Project/Project.vue b/frontend/src/views/sql-editor/Setting/Project/Project.vueindex ca7b4f7fad..ed363cd8f7 100644--- a/frontend/src/views/sql-editor/Setting/Project/Project.vue+++ b/frontend/src/views/sql-editor/Setting/Project/Project.vue@@ -88,10 +88,7 @@ const state = reactive<LocalState>({project: undefined,},});-const { projectList, ready } = useProjectV1List(- /* showDeleted */ false,- /* forceUpdate */ true-);+const { projectList, ready } = useProjectV1List();const filteredProjectList = computed(() => {return filterProjectV1ListByKeyword(projectList.value, state.keyword);