reactjs / react-transition-group

An easy way to perform animations when a React component enters or leaves the DOM
https://reactcommunity.org/react-transition-group/
Other
10.15k stars 650 forks source link

child componentDidMount called before componentWillUnmount with timeout 0 #404

Open nicgirault opened 6 years ago

nicgirault commented 6 years ago

current behavior

When setting transition with timeout 0, the order of call:

is not deterministic.

expected behavior

exiting componentWillUnmount => entering componentDidMount

silvenon commented 6 years ago

By "not deterministic" you mean that they are sometimes called in a different order? Which wall are you hitting with this and when do you need timeout to be 0? I know that's not that relevant, I'm just curious. 🐱

nicgirault commented 6 years ago

Yes I mean it's sometimes called in a different order. Sorry for my English but what do you mean by "Which wall are you hitting with this"?

I set up dynamic transition following this article https://medium.com/lalilo/dynamic-transitions-with-react-router-and-react-transition-group-69ab795815c9 and some pages have no transition this is why some of them have a timeout of 0. I had to move them out of the transition component but it's a bit messy because my transition component is implemented at a higher level than these pages definition. The biggest issue was that it was really tricky to debug.

silvenon commented 6 years ago

Sorry for my English but what do you mean by "Which wall are you hitting with this"?

Nevermind, that question was too generic. You answered the question that I wanted. I'll try to reproduce this in a test, thanks for reporting the issue. ⭐️