Uh oh!
There was an error while loading. Please reload this page.
feat(Transition): Only call findDOMNode if necessary - #468
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.
jquense
commented
Mar 12, 2019
this is cool, the problem nowdays with this approach tho is destructuring messings with the observable arity of the function e.g. functionfoo(...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
c0d151dCompareCherry-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
9e41fc1Compareeps1lon
commented
Oct 14, 2021
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.