Skip to content

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

fix: detect custom theme changes (#8710)

boojack61632321c10e
diff --git a/frontend/naive-ui.config.ts b/frontend/naive-ui.config.ts
index 745e4b68dd..a88f968577 100644
--- a/frontend/naive-ui.config.ts
+++ b/frontend/naive-ui.config.ts
@@ -5,10 +5,8 @@ import {
NLocale,
NDateLocale,
} from "naive-ui";
-
-import { curLocale } from "./src/plugins/i18n";
-
import { computed } from "vue";
+import { curLocale } from "./src/plugins/i18n";
const callVar = (css: string) => {
return getComputedStyle(document.documentElement).getPropertyValue(css);
diff --git a/frontend/src/CustomThemeProvider.vue b/frontend/src/CustomThemeProvider.vue
index dd03a7a35b..16c9afd5af 100644
--- a/frontend/src/CustomThemeProvider.vue
+++ b/frontend/src/CustomThemeProvider.vue
@@ -13,10 +13,9 @@
import { useLocalStorage } from "@vueuse/core";
import { NConfigProvider } from "naive-ui";
import { watch } from "vue";
-import { nextTick } from "vue";
import { useRoute } from "vue-router";
import { themeOverrides, dateLang, generalLang } from "../naive-ui.config";
-import { provideAppRootContext, restartAppRoot } from "./AppRootContext";
+import { provideAppRootContext } from "./AppRootContext";
import { useLanguage } from "./composables/useLanguage";
import { applyCustomTheme } from "./utils/customTheme";
@@ -30,18 +29,14 @@ watch(
() => {
const searchParams = new URLSearchParams(window.location.search);
// Initial custom theme.
- let customTheme = searchParams.get("customTheme") || "";
- if (!customTheme && customTheme !== cachedCustomTheme.value) {
- customTheme = cachedCustomTheme.value;
- }
+ const customTheme =
+ searchParams.get("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();
- });
+ if (customTheme !== cachedCustomTheme.value) {
+ // Save custom theme to local storage.
+ cachedCustomTheme.value = customTheme;
+ }
}
// Initial custom language.
const lang = searchParams.get("lang") || "";