From 827c5de1b23970ba4b70a8c0f3708af424bbef4d Mon Sep 17 00:00:00 2001 From: Popescu Dan Date: Thu, 13 Jun 2024 16:19:03 +0300 Subject: [PATCH] replace usage of `ref(markRaw(...))` width `shallowRef(...)` (#130) --- packages/vike-vue/src/renderer/createVueApp.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/vike-vue/src/renderer/createVueApp.ts b/packages/vike-vue/src/renderer/createVueApp.ts index 3bd3e336..ee67f82c 100644 --- a/packages/vike-vue/src/renderer/createVueApp.ts +++ b/packages/vike-vue/src/renderer/createVueApp.ts @@ -1,7 +1,7 @@ export { createVueApp } export type { ChangePage } -import { type App, createApp, createSSRApp, h, markRaw, nextTick, ref, shallowReactive } from 'vue' +import { type App, createApp, createSSRApp, h, nextTick, shallowRef, shallowReactive } from 'vue' import type { PageContext } from 'vike/types' import { setPageContext } from '../hooks/usePageContext' import { objectAssign } from '../utils/objectAssign' @@ -11,8 +11,8 @@ import { setData } from '../hooks/useData' type ChangePage = (pageContext: PageContext) => Promise async function createVueApp(pageContext: PageContext, ssr: boolean, mainComponentName: 'Head' | 'Page') { - const mainComponentRef = ref(markRaw(pageContext.config[mainComponentName])) - const layoutRef = ref(markRaw(pageContext.config.Layout || [])) + const mainComponentRef = shallowRef(pageContext.config[mainComponentName]) + const layoutRef = shallowRef(pageContext.config.Layout || []) const MainComponent = () => h(mainComponentRef.value) let RootComponent = MainComponent @@ -46,8 +46,8 @@ async function createVueApp(pageContext: PageContext, ssr: boolean, mainComponen assertDataIsObject(data) objectReplace(dataReactive, data) objectReplace(pageContextReactive, pageContext) - mainComponentRef.value = markRaw(pageContext.config[mainComponentName]) - layoutRef.value = markRaw(pageContext.config.Layout || []) + mainComponentRef.value = pageContext.config[mainComponentName] + layoutRef.value = pageContext.config.Layout || [] await nextTick() returned = true if (err) throw err