Skip to content

Commit 2609bdb

Browse files
committed
Fix updating children when the current child re-renders itself.
1 parent 8cc3b26 commit 2609bdb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/ReactCSSTransitionReplace.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,11 @@ export default class ReactCSSTransitionReplace extends React.Component {
8282
const nextChild = nextProps.children ? React.Children.only(nextProps.children) : undefined
8383
const {currentChild} = this.state
8484

85-
if ((!currentChild && !nextChild) || (currentChild && nextChild && currentChild.key === nextChild.key)) {
86-
return
85+
if (currentChild && nextChild && nextChild.key === currentChild.key && !this.state.nextChild) {
86+
// This is the same child, but receiving new props means the child itself has re-rendered
87+
return this.setState({
88+
currentChild: nextChild,
89+
})
8790
}
8891

8992
const {currentKey, prevChildren} = this.state

0 commit comments

Comments
 (0)