-
Notifications
You must be signed in to change notification settings - Fork 92
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
useMeasure does not update when rendering an element conditionally #755
Comments
xobotyi
added a commit
that referenced
this issue
May 12, 2022
7 tasks
xobotyi
added a commit
that referenced
this issue
May 12, 2022
xobotyi
added a commit
that referenced
this issue
May 12, 2022
xobotyi
added a commit
that referenced
this issue
May 12, 2022
🎉 This issue has been resolved in version 14.2.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
The problem is still exist. You can check it if you change library version in provided reproduction sandbox. https://codesandbox.io/s/usemeasure-bug-forked-9umt38 |
xobotyi
added a commit
that referenced
this issue
Jun 30, 2022
github-actions bot
pushed a commit
that referenced
this issue
Jun 30, 2022
## [14.5.1](v14.5.0...v14.5.1) (2022-06-30) ### Bug Fixes * **useMeasure:** support conditional rendering ([76ac155](76ac155)), closes [#755](#755)
🎉 This issue has been resolved in version 14.5.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 byuseMeasure
on an element that is rendered conditionally the measurements are not updated when theref.current
updates.I believe the issue is in the
useResizeObserver
whereref.current
is not added to the dependency list, hence theuseEffect
is not triggered when theref
updates.Here's a simple reproduction
What is the expected behavior?
The values returned from
useMeasure
should be updated if thecurrent
prop of theref
changes.Environment Details
@react-hookz/web
version: 13.2.1react
version: 17.0.2react-dom
version: 17.0.2typescript
version: 4.6.3The text was updated successfully, but these errors were encountered: