How should we acces to nuxt context on Nuxt3 #1109
-
|
When accesing nuxt context for example Is there a different recommended way? |
Beta Was this translation helpful? Give feedback.
Replies: 9 comments
-
|
I'm getting the same warnings when using composables for example |
Beta Was this translation helpful? Give feedback.
-
|
Same here! Is this a Nuxt issue or Pinia? |
Beta Was this translation helpful? Give feedback.
-
|
i also have this promble ,how to resolve it |
Beta Was this translation helpful? Give feedback.
-
|
To get route information in Nuxt3 you can use: const route = useRoute();
const router = useRouter(); |
Beta Was this translation helpful? Give feedback.
-
|
Same problem for me |
Beta Was this translation helpful? Give feedback.
-
|
I'm having the same issue. I want to use Nuxt context from inside a Pinia store so I can access the My action: Console message: |
Beta Was this translation helpful? Give feedback.
-
|
This error is coming from nuxt, not pinia. Here's an example of an older issue where some other 3rd party lib triggered this in Nuxt3, and it was fixed in Nuxt. So I'd assume it's also something to fix on their end. |
Beta Was this translation helpful? Give feedback.
-
|
Any news about this? We still can't access the context from Pinia despite what's explained in the docs 😕 |
Beta Was this translation helpful? Give feedback.
-
|
@T-Zahil and everyone else reaching this thread: From @pinia/nuxt 0.3.0 onwards, you can access nuxt with So you just need to replace This is due to Nuxt dropping legacy context in rc.5. Thanks to the team for taking care of this caveat. Logs are way cleaner now without the warnings :)! |
Beta Was this translation helpful? Give feedback.
@T-Zahil and everyone else reaching this thread:
From @pinia/nuxt 0.3.0 onwards, you can access nuxt with
useNuxtApp(), globally in a store.So you just need to replace
this.$nuxt.foowithuseNuxtApp().foo(or assign useNuxtApp output to a variable of course).This is due to Nuxt dropping legacy context in rc.5.
Thanks to the team for taking care of this caveat. Logs are way cleaner now without the warnings :)!