]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
feat(nuxt): remove wrong `$nuxt` in Nuxt 3
authorEduardo San Martin Morote <posva13@gmail.com>
Wed, 13 Jul 2022 09:42:46 +0000 (11:42 +0200)
committerEduardo San Martin Morote <posva@users.noreply.github.com>
Wed, 13 Jul 2022 10:32:58 +0000 (12:32 +0200)
BREAKING CHANGE: in Nuxt 3, `$nuxt` is no longer available in stores.
This is because it was removed in Nuxt 3 and it is no longer the
_context_ as it used to be. Most of the features used there, like
`$fetch` are now globally available and therefore remove the need of it.
You can also use
[`useNuxtApp()`](https://v3.nuxtjs.org/bridge/bridge-composition-api/)
when necessary.

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

index 608df03c7fbe00c13a013b6f484cc9d21dcb29bd..11d8eb21acb63906414a14df751e19e200f15c87 100644 (file)
@@ -6,12 +6,6 @@ export default defineNuxtPlugin((nuxtApp) => {
   nuxtApp.vueApp.use(pinia)
   setActivePinia(pinia)
 
-  // @ts-expect-error: _p is internal
-  pinia._p.push(({ store }) => {
-    // make it non enumerable so it avoids any serialization and devtools
-    Object.defineProperty(store, '$nuxt', { value: nuxtApp })
-  })
-
   if (process.server) {
     nuxtApp.payload.pinia = pinia.state.value
   } else if (nuxtApp.payload && nuxtApp.payload.pinia) {
@@ -25,13 +19,3 @@ export default defineNuxtPlugin((nuxtApp) => {
     },
   }
 })
-
-declare module 'pinia' {
-  export interface PiniaCustomProperties {
-    /**
-     * Nuxt context.
-     */
-    // FIXME: where is this type?
-    // $nuxt: import('@nuxt/types').Context
-  }
-}