Skip to content

Commit 1ea0440

Browse files
committed
refactor: add back toRaw
1 parent d89614a commit 1ea0440

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/nuxt/src/runtime/plugin.vue3.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { createPinia, setActivePinia } from 'pinia'
22
import type { Pinia } from 'pinia'
33
import { defineNuxtPlugin, useNuxtApp, type Plugin } from '#app'
4+
import { toRaw } from 'vue'
45

56
const plugin: Plugin<{ pinia: Pinia }> = defineNuxtPlugin({
67
name: 'pinia',
@@ -23,7 +24,8 @@ const plugin: Plugin<{ pinia: Pinia }> = defineNuxtPlugin({
2324
hooks: {
2425
'app:rendered'() {
2526
const nuxtApp = useNuxtApp()
26-
nuxtApp.payload.pinia = (nuxtApp.$pinia as Pinia).state.value
27+
nuxtApp.payload.pinia = toRaw(nuxtApp.$pinia as Pinia).state.value
28+
// clear up the reference to pinia on server to avoid holding onto the variable
2729
setActivePinia(undefined)
2830
},
2931
},

0 commit comments

Comments
 (0)