Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/SwitchTransition.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ function areChildrenDifferent(oldChildren, newChildren) {
if (
React.isValidElement(oldChildren) &&
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.

) {
return false;
}
Expand Down
12 changes: 12 additions & 0 deletions test/SwitchTransition-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ describe('SwitchTransition', () => {
expect(wrapper.state('status')).toBe(ENTERED);
});

it('should have default status ENTERED', () => {
const wrapper = mount(
<SwitchTransition>
<Transition timeout={0} key={null}>
<span />
</Transition>
</SwitchTransition>
);

expect(wrapper.state('status')).toBe(ENTERED);
});

it('should have default mode: out-in', () => {
const wrapper = mount(
<SwitchTransition>
Expand Down