-
Notifications
You must be signed in to change notification settings - Fork 47.7k
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
ReactTransitions: Don't animate undefined children #537
ReactTransitions: Don't animate undefined children #537
Conversation
@@ -44,6 +44,11 @@ var ReactTransitionGroupMixin = { | |||
'getTransitionConfig() method.' | |||
); | |||
|
|||
// don't animate undefined children | |||
if (typeof sourceChildren === 'undefined') { |
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.
how about nulls or empty arrays? may be cool to get the keySet and check Object.keys(keySet).length === 0
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.
Object.keys(undefined)
throws (which is the exception i'm trying to avoid).
ReactChildren.map(undefined, fn)
will return undefined
, which will bubble up, until it meets mergeKeySets
which uses Object.keys
.
We could let mergeKeySets
handle the undefined inputs?
I believe this won't properly do the transitions when transitioning away from undefined children. You instead want to treat undefined effectively the same as an empty list -- perhaps just make the change where the Object.keys call is? |
Gracefully handle undefined input to mergeKeySet.
This looks fine to me. The codepath is already O(n^2) so I suspect allocations aren't a huge deal. |
I'll be merging this this week! Sorry for the delay! |
And by this week I mean today |
ReactTransitions: Don't animate undefined children
This fixes: #521