cheapsteak / react-transition-group-plus

A more full-featured transition group for React
Other
269 stars 20 forks source link

Components not leaving #10

Closed wongbsn closed 7 years ago

wongbsn commented 7 years ago

I am currently experiencing some problems with components not leaving. The following scenarios will cause components to stay mounted. I think deferredLeaveRemovalCallbacks are not being called (didn't have this problem with version 0.1.5 which was the last version I used):

// 2 or more components
<TransitionGroupPlus> // simultaneous will not remove component
  <Animate key={this.state.counter} />
</TransitionGroupPlus>

// single component
<TransitionGroupPlus> // simultaneous or out-in will not remove component
  {
    this.state.isMenuOpen
      ? <Menu key="menu" />
      : null
  }
</TransitionGroupPlus>
cheapsteak commented 7 years ago

Ack, it's probably is this commit then https://github.com/cheapsteak/react-transition-group-plus/commit/ab508d6ee04ef5c66f3acfb901cf6f254abfbe5d

I'll roll that back

cheapsteak commented 7 years ago

Was deferLeavingComponentRemoval true or false?

cheapsteak commented 7 years ago

Ack, this was my bad, deferLeavingComponentRemoval should not have defaulted to true

cheapsteak commented 7 years ago

So sorry if this caused you any overtime

Published 0.4 with deferLeavingComponentRemoval to false. Someone wanted deferLeavingComponentRemoval so things that have a leave animation but don't disappear at the end could stay on screen until the next thing entered. This is a problem if nothing enters, or if the enter ends before the leave finishes

I might get rid of deferLeavingComponentRemoval in the future as this isn't really "leaving" since it's hanging around after, should probably be handled by another mechanism

Thanks so much for the detailed error report btw

wongbsn commented 7 years ago

No worries, didn't do any overtime. Thank you for maintaining this awesome library!