mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-14 12:48:16 +00:00
fix(nuxt): don't warn about calling useRoute
in SFC setup (#30788)
This commit is contained in:
parent
b7998f8edb
commit
c01050f7ba
@ -18,7 +18,7 @@ export const useRouter: typeof _useRouter = () => {
|
|||||||
|
|
||||||
/** @since 3.0.0 */
|
/** @since 3.0.0 */
|
||||||
export const useRoute: typeof _useRoute = () => {
|
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.')
|
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()) {
|
if (hasInjectionContext()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user