-
Notifications
You must be signed in to change notification settings - Fork 11
Settings nav #534
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
Settings nav #534
Conversation
…-ui into settings-nav
Codecov Report
@@ Coverage Diff @@
## main #534 +/- ##
=======================================
Coverage 85.57% 85.57%
=======================================
Files 758 758
Lines 15525 15525
Branches 1839 1839
=======================================
Hits 13285 13285
Misses 2209 2209
Partials 31 31
Continue to review full report at Codecov.
|
relativeTo?: ActivatedRoute, | ||
preserveParameters?: string[] | ||
preserveParameters?: string[], | ||
skipLocationChange?: boolean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a shortcut method, instead of modifying this with more optional parameters, can you use navigate
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will be better - create new method similar to navigateWithinApp in navigation service (maybe it'll be helpful in future or it's a rare case?) or just directly use navigate method inside navigation-list component without any shortcut?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would leave navigationService untouched, and call via:
this.navigationService.navigate({
navType: NavigationParamsType.InApp,
path: item.matchPaths[0],
replaceCurrentHistory: item.skipLocationChange,
relativeTo: this.activatedRoute
});
Replacing the history, when changing something other than a query param (which is already supported) should be a rare case. I'm not convinced we need it here, but I definitely don't want to encourage it for future use cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(you beat me to this with the exact change 😄 )
queryParams?: QueryParamObject; | ||
queryParamsHandling?: 'merge' | 'preserve'; | ||
relativeTo?: ActivatedRoute; | ||
skipLocationChange?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is already captured on line 306 (replaceCurrentHistory
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, thanks, will use it instead adding new
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented above
navType: NavigationParamsType.InApp, | ||
path: item.matchPaths[0], | ||
relativeTo: this.activatedRoute, | ||
replaceCurrentHistory: item.skipLocationChange |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So missed this the first time around, but we should clarify our naming (the test actually caught this). There's two separate booleans that the angular supports:
skipLocationChange
: When true, navigates without pushing a new state into history.replaceUrl
: When true, navigates while replacing the current state in history.
To illustrate the distinction, imagine three nav items that are navigated in order (first -> second -> third
)
first: { ..., skipLocationChange: false},
second: { ..., skipLocationChange: true},
third: { ..., skipLocationChange: false}
with the behavior of skipLocationChange
, when complete our history stack looks like:
<third> // Active
<first> // browser back
with the behavior of replaceUrl
, when complete our history stack looks like:
<third> // Active
<second> // browser back
A subtle distinction, but our implementation uses replaceUrl
, so we should name the item's property accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DmitiryPotychkin can we update the naming here to reflect the behavior? In other words, skipLocationChange
on line 124 should be named replaceCurrentHistory
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aaron-steinfeld thank you for the explanation!
Add parameter skipLocationChange for not add certain location to location history stack.