Skip to content

bug: useRoute middleware warning when switching languages #170

Description

@cwandev

Describe the bug

When using the shadcn-docs-nuxt package, the following warning appears in the console when switching between languages (Chinese/English):

[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.

Environment

Packages:

  • Nuxt: 3.17.6/3.18.1/4.0.3
  • shadcn-docs-nuxt: 1.1.2

System:

  • OS: Windows 11 10.0.22621
  • CPU: (12) x64 12th Gen Intel(R) Core(TM) i5-12400
  • Memory: 11.43 GB / 31.75 GB

Binaries:

  • Node: 22.17.0
  • npm: 10.9.2
  • pnpm: 10.14.0

Browsers:

  • Edge: Chromium (131.0.2903.51)
  • Internet Explorer: 11.0.22621.3527

Reproduction

https://github.com/nuxt-one/one-docs

Additional context

This warning only appears during local development (pnpm dev) and does not occur in production builds.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐞 bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions