Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: fetch schema_drift immediately after sync-schema (#9689)

zll600a424552d4ee9
diff --git a/frontend/src/components/DatabaseOverviewPanel.vue b/frontend/src/components/DatabaseOverviewPanel.vue
index 4c2c3a407f..878d1504e4 100644
--- a/frontend/src/components/DatabaseOverviewPanel.vue
+++ b/frontend/src/components/DatabaseOverviewPanel.vue
@@ -174,7 +174,7 @@
import { head } from "lodash-es";
import { computed, reactive, watch, PropType } from "vue";
import { useRoute } from "vue-router";
-import { useAnomalyV1List, useDBSchemaV1Store } from "@/store";
+import { useDBSchemaV1Store } from "@/store";
import { Anomaly } from "@/types/proto/v1/anomaly_service";
import { Engine, State } from "@/types/proto/v1/common";
import { DatabaseMetadataView } from "@/types/proto/v1/database_service";
@@ -198,6 +198,10 @@ const props = defineProps({
required: true,
type: Object as PropType<ComposedDatabase>,
},
+ anomalyList: {
+ required: true,
+ type: Object as PropType<Anomaly[]>,
+ },
});
const route = useRoute();
const state = reactive<LocalState>({
@@ -253,16 +257,12 @@ watch(
{ immediate: true }
);
-const anomalyList = useAnomalyV1List(
- computed(() => ({ database: props.database.name }))
-);
-
const anomalySectionList = computed((): BBTableSectionDataSource<Anomaly>[] => {
const list: BBTableSectionDataSource<Anomaly>[] = [];
- if (anomalyList.value.length > 0) {
+ if (props.anomalyList.length > 0) {
list.push({
title: props.database.name,
- list: anomalyList.value,
+ list: props.anomalyList,
});
}
return list;
diff --git a/frontend/src/views/DatabaseDetail.vue b/frontend/src/views/DatabaseDetail.vue
index 75960c736c..33bdddd40b 100644
--- a/frontend/src/views/DatabaseDetail.vue
+++ b/frontend/src/views/DatabaseDetail.vue
@@ -122,7 +122,10 @@
<NTabs v-model:value="state.selectedTab">
<NTabPane name="overview" :tab="$t('common.overview')">
- <DatabaseOverviewPanel :database="database" />
+ <DatabaseOverviewPanel
+ :database="database"
+ :anomaly-list="anomalyList"
+ />
</NTabPane>
<NTabPane
v-if="allowToChangeDatabase"
@@ -232,7 +235,7 @@
import dayjs from "dayjs";
import { NButton, NTabPane, NTabs } from "naive-ui";
import { ClientError } from "nice-grpc-web";
-import { computed, reactive, watch } from "vue";
+import { computed, reactive, watch, ref, onMounted } from "vue";
import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
import { useRoute } from "vue-router";
@@ -254,6 +257,7 @@ import {
} from "@/components/v2";
import {
pushNotification,
+ useAnomalyV1Store,
useCurrentUserIamPolicy,
useCurrentUserV1,
useDatabaseV1Store,
@@ -265,6 +269,7 @@ import {
DEFAULT_PROJECT_V1_NAME,
unknownEnvironment,
} from "@/types";
+import { Anomaly } from "@/types/proto/v1/anomaly_service";
import { State } from "@/types/proto/v1/common";
import { DatabaseMetadataView } from "@/types/proto/v1/database_service";
import {
@@ -327,6 +332,13 @@ const state = reactive<LocalState>({
const route = useRoute();
const currentUserV1 = useCurrentUserV1();
const currentUserIamPolicy = useCurrentUserIamPolicy();
+const anomalyList = ref<Anomaly[]>([]);
+
+onMounted(async () => {
+ anomalyList.value = await useAnomalyV1Store().fetchAnomalyList({
+ database: database.value.name,
+ });
+});
watch(
() => route.hash,
@@ -553,6 +565,9 @@ const syncDatabaseSchema = async () => {
[database.value.databaseName]
),
});
+ anomalyList.value = await useAnomalyV1Store().fetchAnomalyList({
+ database: database.value.name,
+ });
} catch (error) {
pushNotification({
module: "bytebase",