-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
fix(vue): correct views are now unmounted in tabs #25270
Merged
Merged
Conversation
This file contains 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
liamdebeasi
changed the title
fix(vue0
fix(vue): correct views are now unmounted in tabs
May 10, 2022
liamdebeasi
requested review from
amandaejohnston,
sean-perkins and
a team
and removed request for
a team
May 10, 2022 20:09
liamdebeasi
commented
May 10, 2022
@@ -66,7 +66,8 @@ describe('Tabs', () => { | |||
|
|||
cy.ionPageVisible('tab1'); | |||
|
|||
cy.ionPageDoesNotExist('tab1childone'); | |||
// TODO(FW-1420) | |||
//cy.ionPageDoesNotExist('tab1childone'); |
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 still an issue which is why I am commenting it out. It was previously working by chance and I mistakenly thought it was fixed so I uncommented this line.
amandaejohnston
approved these changes
May 11, 2022
sean-perkins
approved these changes
May 17, 2022
7 tasks
This was referenced Jun 1, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Pull request checklist
Please check if your PR fulfills the following requirements:
npm run build
) was run locally and any changes were pushednpm run lint
) has passed locally and any fixes were made for failuresPull request type
Please check the type of change your PR introduces:
What is the current behavior?
When using
router.go()
it is possible for users to navigate back over multiple views:/page1
-->/page2
-->/page3
-->router.go(-2)
The above example will bring the user back to
/page1
. Since Ionic renders multiple views in the DOM at the same time, it is important that we unmount any intermediary views. For example, if we did not unmount intermediary views then the view for/page2
would never get unmounted. This can result in a DOM node leak. Similarly, we need to re-mount intermediary views if you then calledrouter.go(2)
.For apps that route in a linear manner, this is fine. However, there is a fundamental incompatibility between nested outlets in Ionic (such as tabs) and
router.go()
. The reason is thatrouter.go()
expects routing to be done in a linear manner (such as the example above). Nested outlets such as tabs are fundamentally non-linear. As a result,router.go()
typically will not yield the results that developers are expecting.In the linked issue below, we were trying to anticipate
router.go()
usage which resulted in the wrong view items being unmounted (essentially we tried to unmount an undefined view item).Issue URL: resolves #25255
What is the new behavior?
router.go()
will not be compatible with non-linear applications. In fairness, we never actually supportedrouter.go()
in non-linear environments. The problem was that when we addedrouter.go()
support for linear environments, we never put any limits on when it could be used because we were unaware of the tradeoffs at the time of implementing.Does this introduce a breaking change?
Other information
Dev build: 6.1.5-dev.11652207609.1ba60afe