Repository navigation
Description
Problem
"Probe in app" should run the matcher without navigating. It calls router.navigateByUrl(url, {skipLocationChange: true}) and aborts at RoutesRecognized (packages/ng-devtools/src/router-actions.ts:596-599, :621-623). It only listens to events for its own navigation id.
A canMatch guard can return a UrlTree, for example an auth guard that sends users to /login. In that case Angular cancels the probe navigation and schedules a new navigation to the redirect target (@angular/router 22.1.7 _router-chunk.mjs:2628-2633, :4024-4030, :4552-4563). The new navigation inherits skipLocationChange but has a different id. The probe resolves on the cancel and never aborts it. The redirect target then runs to completion. Its canActivate guards and resolvers run and its component renders. Only the URL bar stays the same.
This affects the docs and the config:
- The router docs say probe does not run
canActivate,canDeactivateor resolvers (apps/docs/src/content/inspectors/router.md, FAQ "Does Probe in app change the URL?"). The agent tools table says it runs "without navigating" (apps/docs/src/content/agents/tools.md:137). actions: {router: false}does not block probe.ROUTER_WRITE_ACTIONSis['navigate', 'abort', 'replay'](packages/ng-devtools/src/config.ts:185, checked indevframe.ts:386-390). The button is not tied tonavigationAllowed()either (app/src/pages/route-tree.ts:45). With navigation turned off, probe can still change the rendered page.
Steps to reproduce
- Add a route with
canMatch: [() => inject(Router).parseUrl('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/login')]. - In the router inspector, enter that route's URL and click "Probe in app".
- The app now renders
/login, but the address bar still shows the old URL.
Proposed scope
- Make probe also abort a follow-up navigation that comes from a redirect of the probe (watch for
RedirectRequestor the next navigation id). Report the redirect target as the result. - Test with a
canMatchguard that returns aUrlTreeand one that returns aRedirectCommand.
Activity