diff --git a/src/runtime/plugin.server.ts b/src/runtime/plugin.server.ts index a9d7a868..89a2dae6 100644 --- a/src/runtime/plugin.server.ts +++ b/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' @@ -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('color-mode', () => reactive({ preference, value: preference,