-
Notifications
You must be signed in to change notification settings - Fork 104
Closed
Labels
Description
Prior Issues
No prior issues
What is the current behavior?
useMeasure
does not update when rendering an element conditionally.
Steps to Reproduce
When using the ref
returned by useMeasure
on an element that is rendered conditionally the measurements are not updated when the ref.current
updates.
I believe the issue is in the useResizeObserver
where ref.current
is not added to the dependency list, hence the useEffect
is not triggered when the ref
updates.
What is the expected behavior?
The values returned from useMeasure
should be updated if the current
prop of the ref
changes.
Environment Details
@react-hookz/web
version: 13.2.1react
version: 17.0.2react-dom
version: 17.0.2typescript
version: 4.6.3- OS: macOS Monterey (12.3.1)
- Browser: Google Chrome Version 101.0.4951.64
- Did this work in previous versions? No