Skip to content

Commit

Permalink
fix: avoid setting color-mode when rendering islands (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Aug 8, 2023
1 parent e4e84fe commit d856d7a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/runtime/plugin.server.ts
Expand Up @@ -16,12 +16,14 @@ const addScript = (head) => {
}

export default defineNuxtPlugin((nuxtApp) => {
const colorMode = useState<ColorModeInstance>('color-mode', () => reactive({
preference,
value: preference,
unknown: true,
forced: false
})).value
const colorMode = nuxtApp.ssrContext && 'islandContext' in nuxtApp.ssrContext
? reactive({})
: useState<ColorModeInstance>('color-mode', () => reactive({
preference,
value: preference,
unknown: true,
forced: false
})).value

const htmlAttrs: Record<string, string> = {}

Expand Down

0 comments on commit d856d7a

Please sign in to comment.