feat(Transition): Only call findDOMNode if necessary#468
feat(Transition): Only call findDOMNode if necessary#468eps1lon wants to merge 3 commits intoreactjs:masterfrom
Conversation
|
|
||
| const doesNotHaveTimeoutOrListener = timeout == null && !this.props.addEndListener | ||
| if (!node || doesNotHaveTimeoutOrListener) { | ||
| if (doesNotHaveTimeoutOrListener) { |
There was a problem hiding this comment.
Has its own commit (87832e9). No test broke upon removing this so I need some guidance to understand this condition.
There was a problem hiding this comment.
That PR did not introduce the evaluation of node.
|
this is cool, the problem nowdays with this approach tho is destructuring messings with the observable arity of the function e.g. function foo(...args) {
console.log(args
}
foo.length // 0 |
It was to good to be true. This would be a breaking change then at which point we might as well remove the call completely.
Any thoughts about #468 (comment)? |
02bee87 to
c0d151d
Compare
Cherry-picking reactjs#468 ## Breaking Callbacks that use argument spread or access `arguments` will not have acces to the DOM node. The DOM node is only passed if Function.prototype.length is greater than 0. ``` // no node passed const noNodeCallback = () => {}; // node passed const withNodeCallback = node => {}; ``` The first callback enables strict mode compatible usage of `Transition`. If you expect the node in callbacks a call to `findDOMNode` is required which issues a warning in `React.StrictMode`.
405fac0 to
9e41fc1
Compare
|
Fixed with #559 |
Another approach to #457. It only calls findDOMNode if any of the callbacks has the node argument specified.
This is only exploratory since seemingly unrelated implementation had to be change. Details at the affected line.