Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fix(nuxt): return global route for useRoute in detached effect scope - #35659

#35659
Merged
danielroe merged 4 commits into
nuxt:mainnuxt/nuxt:mainfrom
KealanAU:fix/18903-useroute-detached-scopeKealanAU/nuxt:fix/18903-useroute-detached-scopeCopy head branch name to clipboard
Jul 18, 2026
Merged

fix(nuxt): return global route for useRoute in detached effect scope#35659
danielroe merged 4 commits into
nuxt:mainnuxt/nuxt:mainfrom
KealanAU:fix/18903-useroute-detached-scopeKealanAU/nuxt:fix/18903-useroute-detached-scopeCopy head branch name to clipboard

Conversation

@KealanAU

Copy link
Copy Markdown
Contributor

🔗 Linked issue

resolves #18903

📚 Description

useRoute() called inside a detached effect scope (e.g. VueUse's createSharedComposable) injects the per-page route provided by RouteProvider, which freezes once its page fork is no longer active — so the shared composable's route never updates after navigation.

  • useRoute now checks whether the current effect scope is (a descendant of) the component's scope
  • Detached scopes fall back to the always-current useNuxtApp()._route, matching vue-router behaviour
  • Normal setup calls and child scopes are unchanged and still receive the per-page route
  • Adds a unit test covering all three cases (fails on main)

@github-actions github-actions Bot added 5.x 🐛 bug Something isn't working as expected labels Jul 18, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jul 18, 2026

Copy link
Copy Markdown

Open in StackBlitz

@nuxt/kit

npm i https://pkg.pr.new/@nuxt/kit@35659

@nuxt/nitro-server

npm i https://pkg.pr.new/@nuxt/nitro-server@35659

nuxt

npm i https://pkg.pr.new/nuxt@35659

@nuxt/rspack-builder

npm i https://pkg.pr.new/@nuxt/rspack-builder@35659

@nuxt/schema

npm i https://pkg.pr.new/@nuxt/schema@35659

@nuxt/vite-builder

npm i https://pkg.pr.new/@nuxt/vite-builder@35659

@nuxt/webpack-builder

npm i https://pkg.pr.new/@nuxt/webpack-builder@35659

commit: 264c36d

@codspeed-hq

codspeed-hq Bot commented Jul 18, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 21 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing KealanAU:fix/18903-useroute-detached-scope (264c36d) with main (f7401c1)

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@KealanAU
KealanAU force-pushed the fix/18903-useroute-detached-scope branch from e6e03ce to 606989f Compare July 18, 2026 19:49
@KealanAU
KealanAU marked this pull request as ready for review July 18, 2026 20:18
@KealanAU
KealanAU requested a review from danielroe as a code owner July 18, 2026 20:18
@KealanAU

Copy link
Copy Markdown
Contributor Author
CleanShot 2026-07-18 at 22 19 17

@coderabbitai

This comment has been minimized.

@danielroe
danielroe added this pull request to the merge queue Jul 18, 2026
Merged via the queue into nuxt:main with commit 09237ba Jul 18, 2026
28 of 29 checks passed
@github-actions github-actions Bot mentioned this pull request Jul 18, 2026
5 tasks
danielroe pushed a commit that referenced this pull request Jul 20, 2026
#35659)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
(cherry picked from commit 09237ba)
@github-actions github-actions Bot mentioned this pull request Jul 20, 2026
danielroe pushed a commit that referenced this pull request Jul 20, 2026
#35659)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
(cherry picked from commit 09237ba)
@coderabbitai coderabbitai Bot mentioned this pull request Jul 22, 2026
18 tasks
danielroe pushed a commit that referenced this pull request Jul 23, 2026
#35659)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
danielroe pushed a commit that referenced this pull request Jul 23, 2026
#35659)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

5.x 🐛 bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

effectScope with useRoute works incorrectly in Nuxt 3

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.