Skip to content

Conversation

AdrianFleming
Copy link

If the SwitchTransition's children both have a null key then they were not equal. If the Router's location has no key then the children were being continually re-rendered with the animation applied.

Add test for null key
If this was called with a key of the Router's location.key and this is null then the children were not equal and the transition was repeatedly fading in and out. This could be seen by opening a new window and browsing to a site where the user had a valid token.
Fix broken build, {null} not null
Copy link
Member

@taion taion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If they have literally no key, then I don't see how we can say one thing or another. In this kind of case, why couldn't you just take e.g. "@@unknown" or something as a fallback key and be more explicit in application space, as opposed to forcing the library into potentially-surprising behavior?

React.isValidElement(newChildren) &&
oldChildren.key != null &&
oldChildren.key === newChildren.key
((oldChildren.key == null && newChildren.key == null) || oldChildren.key === newChildren.key)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would we want to treat null and undefined the same here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@taion, OK. This is how I initially coded it but decided it would be better handled in the component. I'll close the fork therefore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants