Skip to content

Commit

Permalink
fix(nuxt): check for document before modifying class in SSR
Browse files Browse the repository at this point in the history
closes #174
  • Loading branch information
jd-solanki committed Jun 16, 2023
1 parent 56b2114 commit fbf73d6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/anu-vue/src/composables/useAnu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const useAnu = createGlobalState((options?: AnuComposableOptions) => {
watch(activeThemeName, (newThemeName, oldThemeName) => {
const newTheme = themes.value[newThemeName]

if (newTheme && newTheme.class)
if (newTheme && newTheme.class && typeof document !== 'undefined')
document.documentElement.classList.toggle(newTheme.class)

// ℹ️ Initially, `oldThemeName` will be undefined
Expand Down

0 comments on commit fbf73d6

Please sign in to comment.