Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/devtools/src/__tests__/router-features.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ describe('router features on a real Router', () => {
);

it.skipIf(!angularAtLeast('20.2.0'))(
'reports the skip when probing the URL the router is already on',
'matches the URL the router is already on instead of reporting a skip',
async () => {
await router.navigateByUrl('/users/8');
vi.useFakeTimers({ toFake: ['setTimeout', 'clearTimeout'] });
Expand All @@ -301,7 +301,7 @@ describe('router features on a real Router', () => {
await vi.advanceTimersByTimeAsync(10_000);
const result = (await pending) as Record<string, unknown>;
expect(result['error']).toBeUndefined();
expect(result).toMatchObject({ matched: false, reason: expect.stringMatching(/ignored/) });
expect(result).toMatchObject({ matched: true });
expect(router.url).toBe('/users/8');
} finally {
vi.useRealTimers();
Expand Down
7 changes: 6 additions & 1 deletion packages/devtools/src/router-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -742,8 +742,13 @@ function probe(router: AnyRecord, navigations: NavigationRecord[], url: string):
const current = navigationIdOf(router);
targetId = current < 0 ? current : current + 1;
setCaller('probe from DevTools', true);
// 'reload' so probing the current URL is matched instead of skipped as the same URL.
const promise = read(
() => router['navigateByUrl'](url, { skipLocationChange: true }) as Promise<unknown>,
() =>
router['navigateByUrl'](url, {
skipLocationChange: true,
onSameUrlNavigation: 'reload',
}) as Promise<unknown>,
null,
);
promise?.catch?.(() => {});
Expand Down
Loading