Skip to content

Router links in @defer blocks not having correct relative route #54864

@NachmanBerkowitz

Description

@NachmanBerkowitz

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

17.2.1

Description

A RouterLink with a route of ./ should route to the activated route. (eg. <a [routerLink]="'./'" >Link One</a>). But when it is in a defer block, and it is a sibling of a component that imports from material it routes to the app root.
So
@defer(on timer(1000)) { <has-material/> <a [routerLink]="'./'" >Link One</a> } routes to the root.

image

Reproduction

StackBlitz link: https://stackblitz.com/edit/stackblitz-starters-prh2zk
Steps to reproduce:

  1. Have a RouterLink in a defer block that has a relative route
  2. Give it a sibling that imports from Material

Expected Behavior

The router link route should be relative to the current route.

Actual Behavior

The router link route is from the root. The 'ActiveRoute' seems to be incorrect.

Environment

  • Angular: >= 17.2.4
  • CDK/Material: 17.2.2
  • Browser(s): edge, chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows

Metadata

Metadata

Assignees

Labels

P2The issue is important to a large percentage of users, with a workaroundarea: coreIssues related to the framework runtimearea: routerbugcore: deferIssues related to @defer blocks.core: distate: has PR

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions