From f887c43206ed97d9fe1ab94b943aabb72e094bf4 Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Tue, 12 Mar 2019 19:04:33 +0100 Subject: [PATCH 1/3] Remove untested condition --- src/Transition.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Transition.js b/src/Transition.js index a12cf71f..5f4b1ac8 100644 --- a/src/Transition.js +++ b/src/Transition.js @@ -313,7 +313,7 @@ class Transition extends React.Component { this.setNextCallback(handler) const doesNotHaveTimeoutOrListener = timeout == null && !this.props.addEndListener - if (!node || doesNotHaveTimeoutOrListener) { + if (doesNotHaveTimeoutOrListener) { setTimeout(this.nextCallback, 0) return } From 84f951ad49c2a19284df1fa21400ee5ba4f9b4e3 Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Tue, 12 Mar 2019 19:04:48 +0100 Subject: [PATCH 2/3] Only call findDOMNode if necessary --- src/Transition.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Transition.js b/src/Transition.js index 5f4b1ac8..2c65e744 100644 --- a/src/Transition.js +++ b/src/Transition.js @@ -209,7 +209,7 @@ class Transition extends React.Component { if (nextStatus !== null) { // nextStatus will always be ENTERING or EXITING. this.cancelNextCallback() - const node = ReactDOM.findDOMNode(this) + const node = this.needsNode() ? ReactDOM.findDOMNode(this) : null; if (nextStatus === ENTERING) { this.performEnter(node, mounting) @@ -327,6 +327,19 @@ class Transition extends React.Component { } } + needsNode() { + return [ + 'addEndListener', + 'onEnter', + 'onEntering', + 'onEntered', + 'onExit' + ].some(callbackName => { + const callback = this.props[callbackName]; + return callback && callback.length > 0 + }) + } + render() { const status = this.state.status if (status === UNMOUNTED) { From 9e41fc11a772ae18c28e166a2f21a0c6a23acbf2 Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Thu, 11 Apr 2019 15:00:05 +0200 Subject: [PATCH 3/3] test(ci): Run on strict branch --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index b101baa1..2f9ced30 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,3 +12,4 @@ after_success: branches: only: - master + - strict