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.
Here's a simple reproduction
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.1
react version: 17.0.2
react-dom version: 17.0.2
typescript 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
Prior Issues
No prior issues
What is the current behavior?
useMeasuredoes not update when rendering an element conditionally.Steps to Reproduce
When using the
refreturned byuseMeasureon an element that is rendered conditionally the measurements are not updated when theref.currentupdates.I believe the issue is in the
useResizeObserverwhereref.currentis not added to the dependency list, hence theuseEffectis not triggered when therefupdates.Here's a simple reproduction
What is the expected behavior?
The values returned from
useMeasureshould be updated if thecurrentprop of therefchanges.Environment Details
@react-hookz/webversion: 13.2.1reactversion: 17.0.2react-domversion: 17.0.2typescriptversion: 4.6.3