Skip to content

Commit

Permalink
fix: use ref for island color-mode stub and check it is truthy
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Nov 15, 2023
1 parent d54c677 commit 486c28f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/runtime/plugin.server.ts
@@ -1,4 +1,4 @@
import { reactive } from 'vue'
import { reactive, ref } from 'vue'

import type { ColorModeInstance } from './types'
import { defineNuxtPlugin, isVue2, isVue3, useHead, useState, useRouter } from '#imports'
Expand All @@ -16,8 +16,8 @@ const addScript = (head) => {
}

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

0 comments on commit 486c28f

Please sign in to comment.