-
Notifications
You must be signed in to change notification settings - Fork 49.2k
Warn for duplicate ViewTransition names #32752
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
untrackNamedViewTransition(deletedFiber); | ||
} | ||
} | ||
safelyDetachRef(deletedFiber, nearestMountedAncestor); |
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 also noticed that we weren't detaching ViewTransition refs when unmounting. Only hiding.
nearestMountedAncestor, | ||
deletedFiber, | ||
); | ||
return; |
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 can safe some bytes by falling through but it really only works for one case and it's easy to get wrong when copying it so I made this explicit.
Comparing: 4845e16...78a6542 Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: Expand to show
|
}); | ||
runWithFiberInDEV(existing, () => { | ||
console.error( | ||
'The existing <ViewTransition name=%s> duplicate has this stack trace.', |
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 does this mean?
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 don't know how to phrase this so it's not to repetitive when shown together but also somewhat makes sense in isolation if they're show independently. This log entry has the other Fiber's owner/async stack trace. I think we have this pattern of two logs somewhere else.
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.
Oh, you're logging the other component stack. Might be weird to see this in places where the component stack is less visible/collapsed? Could we add the owner component name?
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.
The existing
<ViewTransition name=%s>
duplicate rendered inParent
.
This adds early logging when two ViewTransitions with the same name are mounted at the same time. Whether they're part of a View Transition or not. This lets us include the owner stack of each one. I do two logs so that you can get the stack trace of each one of the duplicates. It currently only logs once for each name which also avoids the scenario when you have many hits for the same name in one commit. However, we could also possibly log a stack for each of them but seems noisy. Currently we don't log if a SwipeTransition is the first time the pair gets mounted which could lead to a View Transition error before we've warned. That could be a separate improvement. DiffTrain build for [8ac25e5](8ac25e5)
[diff facebook/react@740a4f7a...313332d1](facebook/react@740a4f7...313332d) <details> <summary>React upstream changes</summary> - facebook/react#32741 - facebook/react#32726 - facebook/react#32752 - facebook/react#32749 - facebook/react#32748 - facebook/react#32746 </details>
This adds early logging when two ViewTransitions with the same name are mounted at the same time. Whether they're part of a View Transition or not.
This lets us include the owner stack of each one. I do two logs so that you can get the stack trace of each one of the duplicates.
It currently only logs once for each name which also avoids the scenario when you have many hits for the same name in one commit. However, we could also possibly log a stack for each of them but seems noisy.
Currently we don't log if a SwipeTransition is the first time the pair gets mounted which could lead to a View Transition error before we've warned. That could be a separate improvement.