-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Removing findDOMNode #3979
Comments
Hi there, I comment here in this issue because i get a lot of struggle with refs due to the fact their aren't forwarded (e.g: Card). It get better since you add some From react docs :
I don't know if it's in your planning right now but i think i will be a great improvement. |
Oh well, I wanted to comment on this for a long long time. I tried to get this to work without breaking the API (by explicitly passing the ref), but I'm pretty sure it's impossible. I learned a lot about I'm looking forward to the day blueprint will be strict mode ready! |
Thanks for investigating @mormahr. I took a look at this last week as well and attempted to do it without breaking API; I was unable to do so. Once React 17 is released and all our internal applications are migrated to React 16 (likely by the end of this year), I will make it a priority to work on this issue and other 4.x breaking changes. |
fixed by #4623, released in 4.0.0-alpha.0 |
Re-opening since this is now part of v5.0 |
I'm still seeing this when using OverflowList in
|
Yep, I'm aware that Blueprint v4 still has incompatibilities with React strict mode. I'm hoping to get this resolved in the next 6-8 weeks, once I've made more progress on the Popover2 migration work. |
@adidahiya How is the Popover2 migration going? I'd like to use Tooltip2 and Popover2 in React strict mode as soon as it's ready :) |
Unfortunately I've had to reduce the scope of Blueprint v5.0 in order to ship it faster. React strict mode compatibility is now scheduled for Blueprint v6.0. |
Most usage of |
I removed the last instance of Last remaining item is to use the |
Some decomp on the problem of migrating Overlay to use react-transition-group's
|
Update:
I think my analysis about how this can be solved is wrong. See my comment.
As part of the move to strict and concurrent mode support, I'd like to tackle removing usages of
findDOMNode
. I analyzed the scope of changes needed in the first-party components and possible implications on third-party consumers.Alternatives to findDOMNode
Refs (preferred)
Refs are probably the standard way to get access to an HTML node. Instead of explicitly wiring refs through the consuming component, they can often be set through
cloneElement
.Downsides:
Workarounds:
ResizeSensor
)Wrapper element
Downsides:
Workarounds:
display: contents;
(doesn't work all most usages)tagName
, etc. propertiesUsages
ResizeSensor
ResizeSensor uses
findDOMNode
to attach a ResizeObserver to the child node. It requires a single DOM node child and can usecloneElement
to attach a ref. I don't know about the performance implications ofcloneElement
(resize sensor explicitly mentions this in the source comments), butContextMenuTarget
also usescloneElement
. My understanding is thatcloneElement
is pretty cheap. I don't even think it's slower thanfindDOMNode
, so I'd saycloneElement
and attaching a ref is the way to go here.ContextMenuTarget
The element returned by
findDOMNode
is used to check if dark mode is enabled or not, by calling a helper method.ContextMenuTarget
already requires a DOM node and usescloneElement
to attach the event-listener so that we can attach a ref in the same call.Overlay
If I understand this correctly
TransitionGroup
creates a container by instantiating the component passed to it. AsOverlay
requests adiv
, thisdiv
is the element we want a reference to. I currently don't know how to get a ref to thisdiv
. AfaikTransitionGroup
doesn't expose a reference. This needs some further investigation.Conclusion
Without considering
Overlay
, I'd say this is doable without breaking changes. I would split this into three separate tasks.cloneElement
inContextMenuTarget
to attach a ref is a non-breaking change.cloneElement
inResizeSensor
to attach a ref is a non-breaking change.Overlay
needs some further investigation.There have been previous issues that mentioned
findDOMNode
. For reference:The text was updated successfully, but these errors were encountered: