Skip to content

relative routing to a route with empty path causes weird urls and breaks the routing eventually #35687

Closed

Description

@saithis

🐞 bug report

Affected Package

The issue is caused by package @angular/router

Is this a regression?

I dont know

Description

relative navigation to a route with empty path causes the url to contain additional /() on the next navigation. In some constelations undefined can also appear in the url. When the user then does some more navigating, at some point the route won't recognize the url anymore and the app breaks.

🔬 Minimal Reproduction

https://stackblitz.com/edit/angular-lazy-route-relative-bug
I couldn't create the stackblitz with a base path (which I have in my app), so the routing imediatelly breaks, because the routerLink will generate the url as "//(lazy)".

🔥 Exception or Error

I don't get an error, just wrong urls, which then cause the app to break a few navigations later or on page reload.

🌍 Your Environment

Angular Version:


Angular CLI: 8.3.0
Node: 12.9.0
OS: win32 x64
Angular: 8.2.3
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.803.0
@angular-devkit/build-angular      0.803.0
@angular-devkit/build-ng-packagr   0.803.0
@angular-devkit/build-optimizer    0.803.0
@angular-devkit/build-webpack      0.803.0
@angular-devkit/core               8.3.0
@angular-devkit/schematics         8.3.0
@angular/cdk                       8.1.3
@angular/cli                       8.3.0
@angular/material                  8.1.3
@angular/material-moment-adapter   8.1.3
@ngtools/webpack                   8.3.0
@schematics/angular                8.3.0
@schematics/update                 0.803.0
ng-packagr                         5.5.0
rxjs                               6.5.2
typescript                         3.5.3
webpack                            4.39.2

Anything else relevant?

I dont think that it is browser/os specific, but I had the problem with Chrome and Firefox on Windows 10

Activity

  1. added this to the needsTriage milestone on Feb 26, 2020
  2. saithis commented on Feb 27, 2020

    @saithis
    Author

    I found out why stackblitz and my app throw differrent errors. My app is served with a base href and stackblitz isn't. If you inspect the link in the stackblitz reproduction after step 2, the href is "//(lazy)".

  3. changed the title [-]relative routing over lazy route boundaries causes weird urls and breaks the routing eventually[/-] [+]relative routing to a route with empty path causes weird urls and breaks the routing eventually[/+] on Mar 2, 2020
  4. saithis commented on Mar 2, 2020

    @saithis
    Author

    I found out that it hasn't anything to do with lazy loading, so I updated the issue text above. The problem seems to be a relative navigation to a route with empty path.

  5. modified the milestones: needsTriage, Backlog on Mar 5, 2020
  6. added
    router: directives
    on May 28, 2020
  7. atscott commented on May 28, 2020

    @atscott
    Contributor

    also related: #13011

    Also note that {relativeLinkResolution: 'corrected'} does not resolve this issue.

  8. atscott commented on May 29, 2020

    @atscott
    Contributor
  9. added a commit that references this issue on Jun 9, 2020
    585e3f6
  10. added a commit that references this issue on Jun 25, 2020
    2a72b91
  11. angular-automatic-lock-bot commented on Jul 10, 2020

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  12. locked and limited conversation to collaborators on Jul 10, 2020
  13. added a commit that references this issue on Sep 5, 2020
    2298b87
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions