Skip to content

fix(router): add relativeLinkResolution to recognize operator - #26990

Closed
sarunint wants to merge 1 commit into
angular:masterfrom
sarunint:fix-relative-resolution
Closed

sarunint wants to merge 1 commit into
angular:masterfrom
sarunint:fix-relative-resolution

Conversation

@sarunint

@sarunint sarunint commented Nov 7, 2018 •

Copy link
Copy Markdown
Contributor

Close #26983

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

In #22394, a new parameter called relativeLinkResolution had been added to recogize function, but due to router refactorisation in #25740, it has been wrapped by recognize operator, which misses this newly added parameter.
Issue Number: #26983

What is the new behavior?

The recognize operator now includes relativeLinkResolution parameter.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@dirkluijk

Copy link
Copy Markdown
Contributor

Awesome. I will try to add an integration test for this test case.

@dirkluijk

dirkluijk commented Nov 8, 2018 •

Copy link
Copy Markdown
Contributor

@sarunint while writing the tests, I found these weird differences.

Angular 6 master
corrected as expected broken in lazy-loaded modules
legacy broken in normally-loaded modules broken in normally-loaded modules

Compare:

How can there be any difference in url handling when the module is lazily loaded? Can you verify this?

@sarunint

sarunint commented Nov 8, 2018

Copy link
Copy Markdown
Contributor Author

Hmm, interesting. I will investigate soon.

P.S. I make this PR at 4 AM, so it might be sloppy. lol

@dirkluijk

Copy link
Copy Markdown
Contributor

Awesome. I'll wait for your investigation before finishing the integration tests.

@sarunint

sarunint commented Nov 8, 2018

Copy link
Copy Markdown
Contributor Author

@dirkluijk could you send a PR of those tests to my branch to see which test are failing?

@jasonaden

Copy link
Copy Markdown
Contributor

Good catch and thanks for the PR. Please let me know if you need help getting nailing down what's happening here. I would like to get this fixed for the next patch release.

@dirkluijk

Copy link
Copy Markdown
Contributor

I'll submit integration tests for both lazy and non-lazy loaded modules asap.

@googlebot

Copy link
Copy Markdown

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

@googlebot googlebot added cla: no and removed cla: yes labels Nov 8, 2018
@sarunint
sarunint force-pushed the fix-relative-resolution branch from 55d3dbc to da59206 Compare November 8, 2018 20:06
@googlebot

Copy link
Copy Markdown

CLAs look good, thanks!

@googlebot googlebot added cla: yes and removed cla: no labels Nov 8, 2018
@sarunint

sarunint commented Nov 8, 2018

Copy link
Copy Markdown
Contributor Author

@dirkluijk I tried my build with your example, and it works!

https://stackblitz.com/edit/relative-link-res-7-dqxbqr

Could you confirm this?

@sarunint
sarunint force-pushed the fix-relative-resolution branch from d337ee6 to 3fadcdb Compare November 8, 2018 20:44
@dirkluijk

dirkluijk commented Nov 8, 2018 •

Copy link
Copy Markdown
Contributor

@sarunint Your fix works perfect for relativeLinkResolution set to corrected as shown in your StackBlitz. 👍

However, when set to legacy, there still seems to be a difference between lazy-loaded modules and normally-loaded modules:
https://stackblitz.com/edit/relative-link-res-7-4bs9ri

The added tests should cover this case as well. If not, I will take a look at them.

@sarunint
sarunint force-pushed the fix-relative-resolution branch from 3fadcdb to da59206 Compare November 8, 2018 20:47
@sarunint

sarunint commented Nov 8, 2018

Copy link
Copy Markdown
Contributor Author

Oh, I see it now...

@dirkluijk

Copy link
Copy Markdown
Contributor

Weird, the tests fail when running ./test.sh router (as expected), but not with ./test.sh node or ./test.sh browser.

@sarunint

sarunint commented Nov 8, 2018

Copy link
Copy Markdown
Contributor Author

@dirkluijk After further observation, I think that the behaviour is correct all along.

Let me explain.

In v6.1, an option has been added to allow developers to use the correct behaviour of the router (corrected). legacy is also introduce to maintain the old wrong behaviour.

This PR aims to fix only when using corrected, which is a regression when upgrading from v6.1 to v7.0. The legacy behaviour should not be changed.

Am I right?

@dirkluijk

Copy link
Copy Markdown
Contributor

Yeah, there are two issues:

  • the broken corrected behaviour introduced in Angular 7 which is fixed by your effort 👍
  • the broken legacy behaviour in non-lazy loaded modules (which seems to be different from lazy-loaded modules). But that was already broken in Angular 6. So maybe we should not address that issue.

So maybe we should go with just your fix.

@sarunint

sarunint commented Nov 8, 2018 •

Copy link
Copy Markdown
Contributor Author

@sarunint

sarunint commented Nov 8, 2018

Copy link
Copy Markdown
Contributor Author

@jasonaden Should I add some tests so that this will not break again in the future? If that's not needed, I think this is ready for merging.

@sarunint
sarunint force-pushed the fix-relative-resolution branch from ebd49c3 to 5aa5a26 Compare November 9, 2018 08:45
@dirkluijk

Copy link
Copy Markdown
Contributor

@sarunint Maybe you should squash the commits into a single commit?

@sarunint
sarunint force-pushed the fix-relative-resolution branch from 5aa5a26 to 1460f59 Compare November 9, 2018 08:47
@googlebot

Copy link
Copy Markdown

CLAs look good, thanks!

@googlebot googlebot added cla: yes and removed cla: no labels Nov 9, 2018
@sarunint

sarunint commented Nov 9, 2018

Copy link
Copy Markdown
Contributor Author

@dirkluijk Done

@dirkluijk

Copy link
Copy Markdown
Contributor

Good work @sarunint. This one should be good to merge.

@sarunint
sarunint force-pushed the fix-relative-resolution branch from 1460f59 to 9300706 Compare November 9, 2018 09:06
@sarunint sarunint closed this Nov 9, 2018
@sarunint sarunint reopened this Nov 9, 2018
@sarunint
sarunint force-pushed the fix-relative-resolution branch from 9300706 to b0ba236 Compare November 10, 2018 09:44
@sarunint sarunint closed this Nov 10, 2018
@sarunint sarunint reopened this Nov 10, 2018
@jasonaden

Copy link
Copy Markdown
Contributor

Looks good guys! Thanks for this. Running this in against Google codebase now to confirm, then we'll merge.

@jasonaden

Copy link
Copy Markdown
Contributor

Presubmit

@angular-automatic-lock-bot

Copy link
Copy Markdown

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.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Sep 14, 2019
adhambaouz pushed a commit to adhambaouz/angular that referenced this pull request Nov 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: router cla: yes target: patch This PR is targeted for the next patch release type: bug/fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Router: regression in relativeLinkResolution since 7.0.0

5 participants