fix(inspector): registry query cycle deadlock, error surfacing, and back-navigation - #200
Merged
Merged
Conversation
A node's spec was only returned after awaiting its full subtree expansion, so a cyclic edge back to an in-flight name@range made the resolution promises await each other forever (e.g. @nuxt/devtools@4.0.0-alpha.15 froze partway through). Defer subtree expansion to a queue drained to a fixpoint by the driver, so a node resolves to its spec as soon as its version is picked.
…ation When a top-level registry query resolves nothing, throw so the landing shows an error box instead of dropping into an empty graph. Navigate landing -> inspector with router.push (not the implicit replace) so the browser Back button returns to the landing; gate the landing on the reactive router.currentRoute since Landing renders outside <NuxtPage>.
commit: |
antfu
reviewed
Aug 24, 2026
| // Navigate into the inspector with a real history push (not a replace) so | ||
| // the browser Back button returns here to the landing. The landing lives | ||
| // at `/`; once we're on an inspector route the payload renders MainEntry. | ||
| if (isLanding.value) |
Contributor
Author
There was a problem hiding this comment.
Good call — guarded the push on isLanding.value && !error.value in cc0e68c so a failed query keeps the user on the landing. (It's inside the try after a successful resolve today, but the explicit !error.value makes the intent clear and is defensive against any non-throwing error path.)
Guard the landing -> inspector push on `!error.value` as well, per review, so a failed query keeps the user on the landing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Fixes three issues with the web build's Registry Query (Instant) mode.
1. Registry query can silently deadlock on dependency cycles
Some specs (e.g.
@nuxt/devtools@4.0.0-alpha.15) never resolved — the resolver froze partway through with the event loop idle and all network requests already completed.Root cause: in
resolveRegistryDependencies, a node'sspecwas only returned afterawait-ing its entire subtree expansion. A dependency cycle that revisits the same in-flightname@rangetherefore produced resolution promises awaiting each other forever.Fix: decouple node identity from subtree expansion — a node resolves to its
specas soon as its version is picked, and expansion is deferred to a queue drained to a fixpoint by the driver. Cyclic edges back to an in-flight node now resolve immediately.@nuxt/devtools@4.0.0-alpha.15resolves in a few seconds again.2. A failed top-level query dropped users into an empty graph
When none of the requested top-level packages could be resolved, the resolver only recorded warnings and still returned a payload, so the app navigated into an empty grid with just a small toast. It now throws in that case, so the landing page shows its "Failed to Resolve Dependencies" error box instead.
3. Landing → inspector didn't create a history entry
Navigating from the landing into the graph used an implicit
router.replace, so the browser Back button couldn't return to the landing. The landing now lives at/and pushes into/grid/depth, so Back works. (The landing renders outside<NuxtPage>, whereuseRoute()returns a stale snapshot — the reactiverouter.currentRouteis used instead.)Tests
pnpm test,pnpm typecheck,pnpm lint, and theinstant+webcontainerPlaywright suites all pass.This PR was created with the help of an agent.