Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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 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.
Issue number: resolves #31479
What is the current behavior?
Currently, switching tabs or following a link with
routerDirection="none"fires none of the four view lifecycle events, so a page that loads its data inuseIonViewWillEnterrenders empty. The non-animated branch ofStackManager.transitionPage()skipsrouterOutlet.commit()and swaps the page classes itself to avoid intermediate paints, and core dispatches all four events from insidecommit(), so they never fire. A capturing listener on theion-router-outletgets nothing either, so it isn't a problem with the hooks.What is the new behavior?
That branch now dispatches the four events itself, in the same order core's
transition()uses. The class swap moved to after all four, so the leaving page is still on screen for its leave events and the entering page is revealed only once they've fired. That's what core does on the animated path, wherebeforeTransitionun-hides the leaving page andion-page-hiddenonly goes back on aftercommit()resolves, and it matters becauseion-page-hiddenisdisplay: none, so auseIonViewDidLeavehandler readingscrollTopoff the outgoing page was getting 0.The two dispatch sites that already existed in this file for out-of-scope and root navigation now share the same helper.
Does this introduce a breaking change?
Other information
The events used to come from core here. This path called
commit(enteringEl, undefined, { duration: 0 })until 12f0d5e dropped it to fix a white flash during tab switches, and with no leaving element core took itsnoAnimationbranch and fired the enter pair, so the enter half of this is a regression from that commit. Putting the call back would get the events plus focus and z-index handling from core for free, but it risks the flash it was removed for, so this dispatches them directly instead.The patch on the issue fires the enter events unconditionally. This gates them on the generation check so a superseded transition doesn't announce an entry, and it skips the leave events when the leaving page already has
ion-page-hidden, because two transitions sharing a leaving element would otherwise run itsuseIonViewDidLeaveteardown twice. The check is the class rather thanisViewVisiblesince a nested outlet marks its leaving pagevisibility: hiddenbefore we get here and still needsionViewDidLeaveto unmount.Preview:
Current Dev Build