Skip to content

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

fix(frontend): displayed content inconsistent with the actual route (#1942)

ZhengX4e438bb56a9f
diff --git a/frontend/src/views/DatabaseDashboard.vue b/frontend/src/views/DatabaseDashboard.vue
index 352fc4a1b3..87d70aa209 100644
--- a/frontend/src/views/DatabaseDashboard.vue
+++ b/frontend/src/views/DatabaseDashboard.vue
@@ -21,6 +21,7 @@ import {
computed,
watchEffect,
onMounted,
+ onUnmounted,
reactive,
ref,
defineComponent,
@@ -54,6 +55,7 @@ export default defineComponent({
},
setup() {
const searchField = ref();
+ const mountedTimer = ref();
const event = inject<Event>("event");
const uiStateStore = useUIStateStore();
@@ -78,7 +80,7 @@ export default defineComponent({
searchField.value.$el.querySelector("#search").focus();
if (!uiStateStore.getIntroStateByKey("guide.help.database")) {
- setTimeout(() => {
+ mountedTimer.value = setTimeout(() => {
event?.emit(EventType.EVENT_HELP, "help.database", true);
uiStateStore.saveIntroStateByKey({
key: "database.visit",
@@ -88,6 +90,10 @@ export default defineComponent({
}
});
+ onUnmounted(() => {
+ clearTimeout(mountedTimer.value);
+ });
+
const prepareDatabaseList = () => {
// It will also be called when user logout
if (currentUser.value.id != UNKNOWN_ID) {
diff --git a/frontend/src/views/EnvironmentDashboard.vue b/frontend/src/views/EnvironmentDashboard.vue
index 4fc6ba8dec..c33f8ab0e9 100644
--- a/frontend/src/views/EnvironmentDashboard.vue
+++ b/frontend/src/views/EnvironmentDashboard.vue
@@ -62,11 +62,13 @@
<script lang="ts">
import {
onMounted,
+ onUnmounted,
computed,
reactive,
watch,
defineComponent,
inject,
+ ref,
} from "vue";
import { useRouter } from "vue-router";
import { array_swap, Event } from "../utils";
@@ -134,6 +136,7 @@ export default defineComponent({
const policyStore = usePolicyStore();
const router = useRouter();
const event = inject<Event>("event");
+ const mountedTimer = ref();
const state = reactive<LocalState>({
reorderedEnvironmentList: [],
@@ -164,7 +167,7 @@ export default defineComponent({
selectEnvironmentOnHash();
if (!uiStateStore.getIntroStateByKey("guide.help.environment")) {
- setTimeout(() => {
+ mountedTimer.value = setTimeout(() => {
event?.emit(EventType.EVENT_HELP, "help.environment", true);
uiStateStore.saveIntroStateByKey({
key: "environment.visit",
@@ -174,6 +177,10 @@ export default defineComponent({
}
});
+ onUnmounted(() => {
+ clearTimeout(mountedTimer.value);
+ });
+
useRegisterCommand({
id: "bb.environment.create",
registerId: "environment.dashboard",
diff --git a/frontend/src/views/InstanceDashboard.vue b/frontend/src/views/InstanceDashboard.vue
index d82aceead2..fabcca9c79 100644
--- a/frontend/src/views/InstanceDashboard.vue
+++ b/frontend/src/views/InstanceDashboard.vue
@@ -26,6 +26,7 @@
import {
computed,
onMounted,
+ onUnmounted,
reactive,
ref,
defineComponent,
@@ -60,6 +61,7 @@ export default defineComponent({
},
setup() {
const searchField = ref();
+ const mountedTimer = ref();
const event = inject<Event>("event");
const instanceStore = useInstanceStore();
@@ -84,7 +86,7 @@ export default defineComponent({
searchField.value.$el.querySelector("#search").focus();
if (!uiStateStore.getIntroStateByKey("guide.help.instance")) {
- setTimeout(() => {
+ mountedTimer.value = setTimeout(() => {
event?.emit(EventType.EVENT_HELP, "help.instance", true);
uiStateStore.saveIntroStateByKey({
key: "instance.visit",
@@ -94,6 +96,10 @@ export default defineComponent({
}
});
+ onUnmounted(() => {
+ clearTimeout(mountedTimer.value);
+ });
+
const selectEnvironment = (environment: Environment) => {
state.selectedEnvironment = environment;
if (environment) {
diff --git a/frontend/src/views/ProjectDashboard.vue b/frontend/src/views/ProjectDashboard.vue
index d5227e31de..0109fb0012 100644
--- a/frontend/src/views/ProjectDashboard.vue
+++ b/frontend/src/views/ProjectDashboard.vue
@@ -29,6 +29,7 @@ import { useRouter } from "vue-router";
import {
watchEffect,
onMounted,
+ onUnmounted,
reactive,
ref,
defineComponent,
@@ -51,6 +52,7 @@ export default defineComponent({
setup() {
const router = useRouter();
const searchField = ref();
+ const mountedTimer = ref();
const event = inject<Event>("event");
const uiStateStore = useUIStateStore();
@@ -67,7 +69,7 @@ export default defineComponent({
searchField.value.$el.querySelector("#search").focus();
if (!uiStateStore.getIntroStateByKey("guide.help.project")) {
- setTimeout(() => {
+ mountedTimer.value = setTimeout(() => {
event?.emit(EventType.EVENT_HELP, "help.project", true);
uiStateStore.saveIntroStateByKey({
key: "project.visit",
@@ -77,6 +79,10 @@ export default defineComponent({
}
});
+ onUnmounted(() => {
+ clearTimeout(mountedTimer.value);
+ });
+
const prepareProjectList = () => {
// It will also be called when user logout
if (currentUser.value.id != UNKNOWN_ID) {