We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d89614a commit 1ea0440Copy full SHA for 1ea0440
packages/nuxt/src/runtime/plugin.vue3.ts
@@ -1,6 +1,7 @@
1
import { createPinia, setActivePinia } from 'pinia'
2
import type { Pinia } from 'pinia'
3
import { defineNuxtPlugin, useNuxtApp, type Plugin } from '#app'
4
+import { toRaw } from 'vue'
5
6
const plugin: Plugin<{ pinia: Pinia }> = defineNuxtPlugin({
7
name: 'pinia',
@@ -23,7 +24,8 @@ const plugin: Plugin<{ pinia: Pinia }> = defineNuxtPlugin({
23
24
hooks: {
25
'app:rendered'() {
26
const nuxtApp = useNuxtApp()
- 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
29
setActivePinia(undefined)
30
},
31
0 commit comments