refactor(router): Make a few adjustments to createUrlTree for clarity#45306
Closed
atscott wants to merge 1 commit intoangular:masterfrom
Closed
refactor(router): Make a few adjustments to createUrlTree for clarity#45306atscott wants to merge 1 commit intoangular:masterfrom
atscott wants to merge 1 commit intoangular:masterfrom
Conversation
* `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.
AndrewKushnir
approved these changes
Mar 9, 2022
Contributor
AndrewKushnir
left a comment
There was a problem hiding this comment.
Nice refactoring 👍
Contributor
Author
|
This PR was merged into the repository by commit a08ea3f. |
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
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
treefunction now accepts the old root rather than the oldUrlTree. TheurlTreeargument was only used to get theroot.This change makes it more clear what that pararmeter is used for and
what's actually being used
oldRoot(previouslyurlTree) to be the first argument oftree.This change now mirrors the argument order for
replaceSegmentandcan be read from left to right more easily "in this root,
replace this old segment group with this new segment group".
newRootto a variable. This just makes it more clear what'sgoing 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
urlTreeargument at all in thecreateUrlTreefunction. These refactorings will make it easier to see1:1 functionlity in these various places.