Skip to content

Commit

Permalink
fix: correctly load color scheme from settings on launch
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeroen Nijhuis committed Apr 21, 2024
1 parent a710038 commit 69edba0
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import RouterViewport from "@/components/RouterViewport.vue";
import Toaster from "@/components/ui/toast/Toaster.vue";
import CommandPalette from "./components/CommandPalette.vue";
import SettingsContextProvider from "./providers/SettingsContextProvider";
import ColorSchemeProvider from "./providers/ColorSchemeProvider";
import KubeContextProvider from "./providers/KubeContextProvider";
import CommandPaletteProvider from "./providers/CommandPaletteProvider";
import TabProvider from "./providers/TabProvider";
Expand All @@ -18,19 +19,21 @@ import DialogHandler from "./components/DialogHandler.vue";
>
<Suspense>
<SettingsContextProvider>
<KubeContextProvider>
<TabProvider>
<CommandPaletteProvider>
<DialogProvider>
<Navigation />
<RouterViewport />
<Toaster />
<CommandPalette />
<DialogHandler />
</DialogProvider>
</CommandPaletteProvider>
</TabProvider>
</KubeContextProvider>
<ColorSchemeProvider>
<KubeContextProvider>
<TabProvider>
<CommandPaletteProvider>
<DialogProvider>
<Navigation />
<RouterViewport />
<Toaster />
<CommandPalette />
<DialogHandler />
</DialogProvider>
</CommandPaletteProvider>
</TabProvider>
</KubeContextProvider>
</ColorSchemeProvider>
</SettingsContextProvider>
</Suspense>
</AppLayout>
Expand Down
15 changes: 15 additions & 0 deletions src/providers/ColorSchemeProvider.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { SettingsContextStateKey } from "@/providers/SettingsContextProvider";
import { useColorMode } from "@vueuse/core";
import { injectStrict } from "@/lib/utils";

export default {
async setup() {
const { settings } = injectStrict(SettingsContextStateKey);
const colorMode = useColorMode();

colorMode.value = settings.value.appearance.colorScheme;
},
render(): any {
return this.$slots.default();
},
};

0 comments on commit 69edba0

Please sign in to comment.