From 486c28f57cd817cbdbd53bbc9d5302d62bd6b8c9 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Wed, 15 Nov 2023 16:33:46 +0000 Subject: [PATCH] fix: use `ref` for island color-mode stub and check it is truthy --- src/runtime/plugin.server.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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,