Skip to content

Commit

Permalink
replace usage of ref(markRaw(...)) width shallowRef(...) (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
pdanpdan authored Jun 13, 2024
1 parent d9f584b commit 827c5de
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/vike-vue/src/renderer/createVueApp.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -11,8 +11,8 @@ import { setData } from '../hooks/useData'

type ChangePage = (pageContext: PageContext) => Promise<void>
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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 827c5de

Please sign in to comment.