Skip to content

Conversation

@atscott
Copy link
Contributor

@atscott atscott commented Mar 9, 2022

  • tree function now accepts the old root rather than the old
    UrlTree. The urlTree argument was only used to get the root.
    This change makes it more clear what that pararmeter is used for and
    what's actually being used
  • Move the oldRoot (previously urlTree) to be the first argument of tree.
    This change now mirrors the argument order for replaceSegment and
    can be read from left to right more easily "in this root,
    replace this old segment group with this new segment group".
  • Extract newRoot to a variable. This just makes it more clear what's
    going on at the end rather than combining a bunch of operations into
    one.

These changes are being made so that hopefully a future refactor can be
done which does not rely on the urlTree argument at all in the
createUrlTree function. These refactorings will make it easier to see
1:1 functionlity in these various places.

* `tree` function now accepts the old root rather than the old
  `UrlTree`. The `urlTree` argument was only used to get the `root`.
  This change makes it more clear what that pararmeter is used for and
  what's actually being used
* Move the `oldRoot` (previously `urlTree`) to be the first argument of `tree`.
  This change now mirrors the argument order for `replaceSegment` and
  can be read from left to right more easily "in this root,
  replace this old segment group with this new segment group".
* Extract `newRoot` to a variable. This just makes it more clear what's
  going on at the end rather than combining a bunch of operations into
  one.

These changes are being made so that hopefully a future refactor can be
done which does not rely on the `urlTree` argument at all in the
`createUrlTree` function. These refactorings will make it easier to see
1:1 functionlity in these various places.
@atscott atscott added area: router target: patch This PR is targeted for the next patch release labels Mar 9, 2022
@ngbot ngbot bot modified the milestone: Backlog Mar 9, 2022
Copy link
Contributor

@AndrewKushnir AndrewKushnir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice refactoring 👍

@atscott atscott added the action: merge The PR is ready for merge by the caretaker label Mar 9, 2022
@atscott
Copy link
Contributor Author

atscott commented Mar 9, 2022

This PR was merged into the repository by commit a08ea3f.

@atscott atscott closed this in a08ea3f Mar 9, 2022
atscott added a commit that referenced this pull request Mar 9, 2022
…#45306)

* `tree` function now accepts the old root rather than the old
  `UrlTree`. The `urlTree` argument was only used to get the `root`.
  This change makes it more clear what that pararmeter is used for and
  what's actually being used
* Move the `oldRoot` (previously `urlTree`) to be the first argument of `tree`.
  This change now mirrors the argument order for `replaceSegment` and
  can be read from left to right more easily "in this root,
  replace this old segment group with this new segment group".
* Extract `newRoot` to a variable. This just makes it more clear what's
  going on at the end rather than combining a bunch of operations into
  one.

These changes are being made so that hopefully a future refactor can be
done which does not rely on the `urlTree` argument at all in the
`createUrlTree` function. These refactorings will make it easier to see
1:1 functionlity in these various places.

PR Close #45306
@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 Apr 9, 2022
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 target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants