-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ClickAwayListener] Remove findDOMNode usage #15179
[ClickAwayListener] Remove findDOMNode usage #15179
Conversation
Details of bundle changes.Comparing: ae24eea...aee82dc
|
packages/material-ui/src/ClickAwayListener/ClickAwayListener.js
Outdated
Show resolved
Hide resolved
@eps1lon We have to solve the same problem with the
|
What is scaling here?
What's the downside? I would rather add some code to avoid subtle bugs with findDOMNode.
I don't trust this approach to be honest. I'm not sure this properly updates if the ref value of the children changes. |
That's why I said I don't trust it not that it doesn't work.
Why do we need this everywhere? |
Do you want me to prepare a test?
Because we want to make the usage of |
I wouldn't be satisfied by any tests since it won't include concurrent react. What I was hoping for was some official docs for it. I thought about it a bit more and it seems obvious that this "just" works: https://codesandbox.io/s/n730ozwrrl. I'm just a little bit uncomfortable with all the ref forking without proper cleanup. |
…ickAwayListener/no-findDOMNode
0a18925
to
dc7cb3d
Compare
a47a796
to
4ad6c94
Compare
4ad6c94
to
1caa634
Compare
Premature optimization but child refs could contain side-effects so we dont't want to reduce wasteful calls for them as much as possible
return ( | ||
<React.Fragment> | ||
{React.cloneElement(children, { ref: handleRef })} | ||
<EventListener target="document" {...listenerProps} {...other} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we will be able to kill this :)
Removes
findDOMNode
calls.Breaking change
The child element of
ClickAwayListener
needs to be able to hold a ref.