-
-
Notifications
You must be signed in to change notification settings - Fork 241
fix(location-strategy): find the correct outlet when navigating back and forward #1404
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
FrameServices should be responsible for delivering the correct topmost frame too
4cef7df
to
905e3df
Compare
test android#4.2.0-2018-06-18-02 |
test |
run ci |
getFrame(): Frame { | ||
return topmost(); | ||
let tompostFrame = topmost(); |
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.
tompostFrame -> topmostFrame typo
@@ -134,11 +134,11 @@ function createState(url: string, | |||
|
|||
function simulatePageNavigation(strategy: NSLocationStrategy, url: string, outletName: string) { | |||
strategy.pushState(null, null, url, null); | |||
strategy._beginPageNavigation(outletName); | |||
strategy._beginPageNavigation(outletName, null); |
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.
Do we need to explicitly pass null
here to clarify or it can be an optional param?
const { cachedFrame, cachedFrameRootOutlet } = this.findFrame(topmostFrame); | ||
|
||
if (cachedFrame && cachedFrameRootOutlet) { | ||
const latestFrameByOutlet = this.getLatestFrameByOutlet(cachedFrameRootOutlet); |
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.
Maybe a better name would be topmostFrameByOutlet (for variable and method)
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.
Resolved
if (cachedFrame && cachedFrameRootOutlet) { | ||
const latestFrameByOutlet = this.getLatestFrameByOutlet(cachedFrameRootOutlet); | ||
|
||
if (latestFrameByOutlet && latestFrameByOutlet !== cachedFrame) { |
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 is the scenario where we do not have latestFrameByOutlet
-- can we add it as a comment?
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.
Resolved
2a92e9f
to
2eabf23
Compare
…ativescript-angular into djenkov/location-strategy
2eabf23
to
e5f1663
Compare
@ADjenkov it appears this commit may have broken routing badly in all existing apps - perhaps you can ping us on {N} community slack and we can provide more details. Too deep to post example for. |
For anyone whom is using |
Extend
FrameService
to return the correct topmost frameWhen using TabView, with multiple tabs that have
<p-r-o>
, the topmost frame will currently return the root<p-r-o>
for the current tab item even if there is a child<p-r-o>
(even it is the last navigated frame). This will affect back navigation.Extend
FrameService
to maintain<p-r-o>
framesModify
ns-location-strategy
to mark the correct outlet state asisPageNavigation
In order to recognize the correct
currentOutlet
, when navigating back and forward, we bind outlets names with their uniqueFrames
and parent outlets (since there could be outlets with the same names but different frame instances).Knowing the parent outlet, along with its frame, helps us distinguish root and child outlets
Modal view from different tab item issue: When using TabView with multiple tabs that have
<p-r-o>
thecurrentOutlet
will be the last<p-r-o>
that was navigated. This could be wrong since we could be landing on some other tab and decide to show Modal view from it. We need to mark the correct outlet state asisModalNavigation
(the outlet from in which the modal view is shown) otherwise the wrong router states will be removed later on (and some other bad things).When opening modal view we pass the Frame from which the modal view was shown and search for it ( from our Frames collection) in order to find the correct outlet
Add e2e tests for modal-navigation scenarios
TO DO: Extend
ns-location-strategy
unit tests