Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(useViewportEffect): support changing recalculateLayoutBeforeUpdat…
…e in combination with deferUpdateUntilIdle When recalculateLayoutBeforeUpdate is used with a dynamic value in a function, e.g. useRect, the function is not reassninged to the listener. This can especially become an issue with deferUpdateUntilIdle. In the example of useRect, the deferred function will be called with the old element (which might be null) and the update which is triggered afterwards containing the new function is not respected any longer. Afterwards the dependency is not changing any longer, therefore the state stays undefined. Using a dynamic function that calls the latest function independent of when it was registered fixes the issue. Closes #16
- Loading branch information