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: custom theme provider (#8708)
boojacke1f0ac13e530
diff --git a/frontend/src/CustomThemeProvider.vue b/frontend/src/CustomThemeProvider.vueindex b9a7ce3df6..dd03a7a35b 100644--- a/frontend/src/CustomThemeProvider.vue+++ b/frontend/src/CustomThemeProvider.vue@@ -1,6 +1,5 @@<template><NConfigProvider- v-if="initialized":key="key":locale="generalLang":date-locale="dateLang"@@ -13,33 +12,45 @@<script lang="ts" setup>import { useLocalStorage } from "@vueuse/core";import { NConfigProvider } from "naive-ui";-import { onMounted, ref } from "vue";+import { watch } from "vue";+import { nextTick } from "vue";+import { useRoute } from "vue-router";import { themeOverrides, dateLang, generalLang } from "../naive-ui.config";-import { provideAppRootContext } from "./AppRootContext";+import { provideAppRootContext, restartAppRoot } from "./AppRootContext";import { useLanguage } from "./composables/useLanguage";import { applyCustomTheme } from "./utils/customTheme";+const route = useRoute();const { key } = provideAppRootContext();const { setLocale } = useLanguage();-const initialized = ref(false);+const cachedCustomTheme = useLocalStorage<string>("bb.custom-theme", "");-onMounted(() => {- const searchParams = new URLSearchParams(window.location.search);- // Initial custom theme.- let customTheme = searchParams.get("customTheme") || "";- const cachedCustomTheme = useLocalStorage<string>("bb.custom-theme", "");- if (!customTheme && cachedCustomTheme.value) {- customTheme = cachedCustomTheme.value;+watch(+ () => route.fullPath,+ () => {+ const searchParams = new URLSearchParams(window.location.search);+ // Initial custom theme.+ let customTheme = searchParams.get("customTheme") || "";+ if (!customTheme && customTheme !== cachedCustomTheme.value) {+ customTheme = cachedCustomTheme.value;+ }+ if (customTheme) {+ cachedCustomTheme.value = customTheme;+ applyCustomTheme(customTheme);+ // If custom theme is applied, we need to restart the app root to make sure+ // the theme is applied to root variables.+ nextTick(() => {+ restartAppRoot();+ });+ }+ // Initial custom language.+ const lang = searchParams.get("lang") || "";+ if (lang) {+ setLocale(lang);+ }+ },+ {+ immediate: true,}- if (customTheme) {- cachedCustomTheme.value = customTheme;- applyCustomTheme(customTheme);- }- // Initial custom language.- const lang = searchParams.get("lang") || "";- if (lang) {- setLocale(lang);- }- initialized.value = true;-});+);</script>diff --git a/frontend/src/layouts/SQLEditorLayout.vue b/frontend/src/layouts/SQLEditorLayout.vueindex 206b0a1b3a..a3dc7948b3 100644--- a/frontend/src/layouts/SQLEditorLayout.vue+++ b/frontend/src/layouts/SQLEditorLayout.vue@@ -44,7 +44,7 @@ const showBanners = computed(() => {onMounted(() => {const searchParams = new URLSearchParams(window.location.search);- let mode = (searchParams.get("mode") || "BUNDLED") as SQLEditorMode;+ let mode = searchParams.get("mode") as SQLEditorMode;const cachedMode = useLocalStorage<SQLEditorMode>("bb.sql-editor.mode","BUNDLED"