maisano / react-router-transition

painless transitions built for react-router, powered by react-motion
http://maisano.github.io/react-router-transition/
MIT License
2.59k stars 138 forks source link

When change route quickly, the last route component did not unmount. #21

Open CupNoodleFork opened 8 years ago

CupNoodleFork commented 8 years ago

I switch between two paths repeatedly,until the animation finished,then the last route Component will unmount actually. so, I can not do something in componentWillmount in the last Component

maisano commented 8 years ago

hi @CupNoodleFork. if i understand correctly, is the problem that when navigating back and forth between the same two routes too quickly you're unable to rely upon componentWillMount because neither of them had actually unmounted?

shfx commented 7 years ago

Same problem here. @CupNoodleFork, did you resolve the issue?

jmhuret commented 7 years ago

I'm experiencing the same issue. @maisano it seems that if you navigate once and then before the transition time has elapsed from that transition, then you navigate a second time (clicking a link, etc), there is an undesirable overlap in the pages.

Perhaps as a workaround, you could advise on how to speed up the transitions? While this does not quite fix the issue at hand, at least there is less opportunity for this behavior to occur.

jmhuret commented 7 years ago

Just noticed this in the closed issues: https://github.com/maisano/react-router-transition/issues/10

@CupNoodleFork FWIW, updating my code to make use of faster transitions did help this problem stop showing up. I believe the issue is still there, but nobody encounters it anymore.

CupNoodleFork commented 7 years ago

@jmhuret thx, faster transitions may work.

CupNoodleFork commented 7 years ago

@maisano yes. I'm unable to do something in componentWillMount, but it seems reasonable when in transition.

maisano commented 7 years ago

@jmhuret that overlap is currently working as designed. spring animations are meant to be interruptible, so if you spam /a -> /b -> /a and so on, the component that was previously animating out will animate back in from its current position. i'm not sure subverting this in a reasonable manner is possible with react-router-transition as we use react-motion under the hood.