]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
refactor: add back toRaw
authorEduardo San Martin Morote <posva13@gmail.com>
Mon, 3 Nov 2025 10:00:51 +0000 (11:00 +0100)
committerEduardo San Martin Morote <posva13@gmail.com>
Mon, 3 Nov 2025 10:02:23 +0000 (11:02 +0100)
packages/nuxt/src/runtime/plugin.vue3.ts

index 614910f10a01f4dfef5763b7fa408f72cf90c717..4b5a0d6765b31977f26df72b9d41dbc555fb0772 100644 (file)
@@ -1,6 +1,7 @@
 import { createPinia, setActivePinia } from 'pinia'
 import type { Pinia } from 'pinia'
 import { defineNuxtPlugin, useNuxtApp, type Plugin } from '#app'
+import { toRaw } from 'vue'
 
 const plugin: Plugin<{ pinia: Pinia }> = defineNuxtPlugin({
   name: 'pinia',
@@ -23,7 +24,8 @@ const plugin: Plugin<{ pinia: Pinia }> = defineNuxtPlugin({
   hooks: {
     'app:rendered'() {
       const nuxtApp = useNuxtApp()
-      nuxtApp.payload.pinia = (nuxtApp.$pinia as Pinia).state.value
+      nuxtApp.payload.pinia = toRaw(nuxtApp.$pinia as Pinia).state.value
+      // clear up the reference to pinia on server to avoid holding onto the variable
       setActivePinia(undefined)
     },
   },