Compare commits

...

3 Commits

Author SHA1 Message Date
Idorenyin Udoh
b53ff35520
Merge baa68a6491 into 160efe7a7f 2025-02-18 18:12:39 +00:00
Idorenyin Udoh
baa68a6491
Merge branch 'main' into patch-2 2025-02-18 19:12:35 +01:00
Idorenyin Udoh
85b8d01455
docs: update nuxt context section in 6.nuxt-app.md
specify the exact middleware types that the nuxt context is accessible in
2025-02-16 13:20:33 +01:00

View File

@ -23,7 +23,7 @@ Jump over the `NuxtApp` interface documentation.
Many composables and utilities, both built-in and user-made, may require access to the Nuxt instance. This doesn't exist everywhere on your application, because a fresh instance is created on every request.
Currently, the Nuxt context is only accessible in [plugins](/docs/guide/directory-structure/plugins), [Nuxt hooks](/docs/guide/going-further/hooks), [Nuxt middleware](/docs/guide/directory-structure/middleware), and [setup functions](https://vuejs.org/api/composition-api-setup.html) (in pages and components).
Currently, the Nuxt context is only accessible in [plugins](/docs/guide/directory-structure/plugins), [Nuxt hooks](/docs/guide/going-further/hooks), [Nuxt middleware](/docs/guide/directory-structure/middleware) (in named and global route middleware), and [setup functions](https://vuejs.org/api/composition-api-setup.html) (in pages and components).
If a composable is called without access to the context, you may get an error stating that 'A composable that requires access to the Nuxt instance was called outside of a plugin, Nuxt hook, Nuxt middleware, or Vue setup function.' In that case, you can also explicitly call functions within this context by using [`nuxtApp.runWithContext`](/docs/api/composables/use-nuxt-app#runwithcontext).