From 5eea29d04357e2d777c9bfb6122445275296b9c4 Mon Sep 17 00:00:00 2001 From: Mohan Date: Mon, 10 Aug 2026 19:51:53 +0800 Subject: [PATCH] fix(theme): wrap useTheme return with reactive() so toggle text updates immediately useTheme returned a plain object, so template access to theme.isDark didn't track reactive dependencies. wrapping with reactive() ensures ref auto-unwrapping and proper change detection. --- src/composables/useTheme.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/composables/useTheme.ts b/src/composables/useTheme.ts index 87fc2a1..828dad3 100644 --- a/src/composables/useTheme.ts +++ b/src/composables/useTheme.ts @@ -1,4 +1,4 @@ -import { ref } from 'vue' +import { ref, reactive } from 'vue' const STORAGE_KEY = 'mach-theme' const isDark = ref(false) @@ -29,8 +29,8 @@ export function initTheme(): void { export function useTheme() { initTheme() - return { + return reactive({ isDark, toggle: () => applyTheme(!isDark.value) - } + }) } \ No newline at end of file