fix(react-router): skip page clone when nothing will animate - #31387
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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: internal
What is the current behavior?
StackManager.transitionPage()clones the leaving page on same-view transitions (/user/1to/user/2) socommit()gets a leaving element distinct from the entering one. It clones even when nothing will animate, which duplicates the page in the DOM for the length of the commit. Playwright locators then resolve to two elements and fail on a strict mode violation, which randomly fails CI and appears as a flake.What is the new behavior?
The clone is gated on whether
commit()will actually animate, mirroring the checkion-router-outletmakes. When it won't,commit()getsundefinedfor the leaving element, which it already handles, and no duplicate reaches the DOM. Two regression tests record the peak number of matching pages across a navigation so a reappearing duplicate fails directly instead of surfacing as a flake.Does this introduce a breaking change?
Other information
The duplicate was never visible on screen. With animations off the clone is attached for about 5ms without crossing a frame boundary, and with animations on it carries
ion-page-invisible(opacity 0) untilafterTransition, which runs just before it's removed. This is a DOM-level fix, not a rendering one.