Skip to content

Router.createUrlTree(...) creates new UrlTree which reuses UrlSegmentGroups from the Router.currentUrlTree #54624

Description

@miiihi

Which @angular/* package(s) are the source of the bug?

router

Is this a regression?

No

Description

Modfying UrlTree created by Router.createUrlTree(...) can modify (because of shared/reused UrlSegmentGroups) the Router.currentUrlTree which can lead to really hard to debug bugs...

Router.createUrlTree(...) should return a completetely new and indepentent UrlTree or the behaviour with warning should be documented.

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 15.2.10
Node: 20.11.1 (Unsupported)
Package Manager: npm 10.4.0
OS: win32 x64

Angular: 15.2.10
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router

Package                          Version
----------------------------------------------------------
@angular-devkit/architect        0.1502.10
@angular-devkit/build-angular    15.2.10
@angular-devkit/core             15.2.10
@angular-devkit/schematics       15.2.10
@angular-devkit/schematics-cli   15.2.10
@angular/cdk                     15.2.9
@angular/google-maps             15.2.9
@schematics/angular              15.2.10
ng-packagr                       15.2.2
rxjs                             7.8.1
typescript                       4.9.5

Anything else?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: router

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions