Skip to content

Commit fbf73d6

Browse files
committed
fix(nuxt): check for document before modifying class in SSR
closes #174
1 parent 56b2114 commit fbf73d6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/anu-vue/src/composables/useAnu.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const useAnu = createGlobalState((options?: AnuComposableOptions) => {
4545
watch(activeThemeName, (newThemeName, oldThemeName) => {
4646
const newTheme = themes.value[newThemeName]
4747

48-
if (newTheme && newTheme.class)
48+
if (newTheme && newTheme.class && typeof document !== 'undefined')
4949
document.documentElement.classList.toggle(newTheme.class)
5050

5151
// ℹ️ Initially, `oldThemeName` will be undefined

0 commit comments

Comments
 (0)