From bbef6a8f18f5aa9cb7e5de473d48b21e6956c320 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Sun, 10 Nov 2024 00:32:21 +0800 Subject: [PATCH] fix(theme): incorrect ssr in `dark-mode` --- theme/src/client/composables/dark-mode.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/theme/src/client/composables/dark-mode.ts b/theme/src/client/composables/dark-mode.ts index a1b14f80..909cbd48 100644 --- a/theme/src/client/composables/dark-mode.ts +++ b/theme/src/client/composables/dark-mode.ts @@ -10,6 +10,8 @@ export const darkModeSymbol: InjectionKey = Symbol( ) export function enableTransitions() { + if (typeof document === 'undefined') + return false return 'startViewTransition' in document && window.matchMedia('(prefers-reduced-motion: no-preference)').matches }