Skip to content

Commit

Permalink
Fixed the setTimeout cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ConneXNL committed Feb 11, 2017
1 parent 92832eb commit 1820a69
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/FlipMove.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ class FlipMove extends Component {
this.cleanupFallback = setTimeout(() => {
const remainingTransitions = Object.values(this.transitionEndHandlerMap);
if (remainingTransitions.length > 0) {
console.log("We forced a cleanup. If you are reading this and you " +
"can replicate this please file an issue in FlipMove on github");
// You did some really weird stuff for this to trigger...
// We are going to do a manual cleanup for now until we can cover all the super edge cases...
Object.values(this.transitionEndHandlerMap).forEach(({ callback }) => {
callback();
})
Expand Down Expand Up @@ -393,8 +393,6 @@ class FlipMove extends Component {

/*console.log("Shuffled:");
console.log(this.childrenHaveShuffled);*/


return updatedChildren;
}

Expand Down Expand Up @@ -641,7 +639,7 @@ class FlipMove extends Component {
if (!ev || ev.propertyName === "transform" || !waitForTransformToFinish) {
// It's possible that this handler is fired not on our primary transition,
// but on a nested transition (eg. a hover effect). Ignore these cases.
if (!ev || ev.target !== domNode) return;
if (ev && ev.target !== domNode) return;

// Remove the 'transition' inline style we added. This is cleanup.
domNode.style.transition = '';
Expand Down Expand Up @@ -673,6 +671,8 @@ class FlipMove extends Component {
triggerFinishHooks(child, domNode) {
if (this.props.onFinish) this.props.onFinish(child, domNode);

//console.log(Object.keys(this.transitionEndHandlerMap).length);

// We check if all transitionEndHandlers have finished...
if (Object.keys(this.transitionEndHandlerMap).length === 0) {

Expand Down

0 comments on commit 1820a69

Please sign in to comment.