diff --git a/packages/nuxt/src/app/composables/router.ts b/packages/nuxt/src/app/composables/router.ts index 3f95ffe8ec..7914e8e5ee 100644 --- a/packages/nuxt/src/app/composables/router.ts +++ b/packages/nuxt/src/app/composables/router.ts @@ -18,7 +18,7 @@ export const useRouter: typeof _useRouter = () => { /** @since 3.0.0 */ export const useRoute: typeof _useRoute = () => { - if (import.meta.dev && isProcessingMiddleware()) { + if (import.meta.dev && !getCurrentInstance() && isProcessingMiddleware()) { console.warn('[nuxt] Calling `useRoute` within middleware may lead to misleading results. Instead, use the (to, from) arguments passed to the middleware to access the new and old routes.') } if (hasInjectionContext()) {