Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(router): state data missing in routerLink #33203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

santoshyadavdev
Copy link
Contributor

Fixes 33173

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?

Issue Number: #33173

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@santoshyadavdev santoshyadavdev requested a review from a team as a code owner October 16, 2019 19:47
@santoshyadavdev santoshyadavdev changed the title [WIP]fix(router): state data missing in routerLink fix(router): state data missing in routerLink Oct 16, 2019
@ngbot ngbot bot modified the milestone: needsTriage Oct 17, 2019
@atscott
Copy link
Contributor

atscott commented Mar 2, 2020

presubmit shows we'll need to update some tests when we sync. Running global presubmit now.

edit: global is now green.

@atscott atscott added the merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note label Mar 2, 2020
@ngbot ngbot bot added the action: merge The PR is ready for merge by the caretaker label Mar 2, 2020
@ngbot
Copy link

ngbot bot commented Mar 2, 2020

I see that you just added the PR action: merge label, but the following checks are still failing:
    failure status "google3" is failing
    pending missing required labels: PR target: *

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken master, please try rebasing to master and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

@atscott atscott added action: presubmit The PR is in need of a google3 presubmit action: merge The PR is ready for merge by the caretaker and removed action: merge The PR is ready for merge by the caretaker merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note action: presubmit The PR is in need of a google3 presubmit labels Mar 2, 2020
@ngbot
Copy link

ngbot bot commented Mar 4, 2020

I see that you just added the PR action: merge label, but the following checks are still failing:
    failure status "google3" is failing
    pending missing required labels: PR target: *

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken master, please try rebasing to master and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

@atscott atscott added the target: patch This PR is targeted for the next patch release label Mar 4, 2020
@matsko matsko closed this in de67978 Mar 4, 2020
matsko pushed a commit that referenced this pull request Mar 4, 2020
matsko added a commit to matsko/angular that referenced this pull request Mar 5, 2020
@atscott
Copy link
Contributor

atscott commented Mar 5, 2020

Hi @santoshyadav198613, the commit for this PR is being reverted since it's missing a test. Could you please open a new PR an add a test similar to this one:

it('should support history state',
fakeAsync(inject([Router, Location], (router: Router, location: SpyLocation) => {
const fixture = createRoot(router, RootCmp);
router.resetConfig([{
path: 'team/:id',
component: TeamCmp,
children: [
{path: 'link', component: LinkWithState}, {path: 'simple', component: SimpleCmp}
]
}]);
router.navigateByUrl('/team/22/link');
advance(fixture);
const native = fixture.nativeElement.querySelector('a');
expect(native.getAttribute('href')).toEqual('/team/22/simple');
native.click();
advance(fixture);
expect(fixture.nativeElement).toHaveText('team 22 [ simple, right: ]');
// Check the history entry
const history = (location as any)._history;
expect(history[history.length - 1].state.foo).toBe('bar');
expect(history[history.length - 1].state)
.toEqual({foo: 'bar', navigationId: history.length});
})));

matsko added a commit that referenced this pull request Mar 5, 2020
@matsko matsko reopened this Mar 5, 2020
@matsko
Copy link
Contributor

matsko commented Mar 5, 2020

@santoshyadav198613 unfortunately we couldn't keep the commit in master because there were no tests for this patch. Can some tests be added. I believe @atscott will help look into this.

@matsko matsko removed the action: merge The PR is ready for merge by the caretaker label Mar 5, 2020
@santoshyadavdev
Copy link
Contributor Author

Sure let me add the test case, will open a new PR.

@atscott atscott added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Mar 18, 2020
@atscott
Copy link
Contributor

atscott commented Apr 6, 2020

Fixed in #36462

@atscott atscott closed this Apr 6, 2020
@angular-automatic-lock-bot
Copy link

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 May 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews 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.

4 participants