You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to automatic batching in react18, state updates in useMeasure's ResizeObserver may be applied after paint. This can cause visual glitches if we depend on useMeasure dimensions for visual updates.
They are recommending that state updates in ResizeObserver should be wrapped in flushSync from ReactDOM.
Can we do this in useMeasure or at least add optional support for flushSync in useMeasure. So that consumers can opt-in if they are using the dimensions for visual update(For eg. in useLayoutEffect).
React version: 18
Due to automatic batching in react18, state updates in useMeasure's ResizeObserver may be applied after paint. This can cause visual glitches if we depend on
useMeasure
dimensions for visual updates.Same issue is raised in react: facebook/react#24331
They are recommending that state updates in ResizeObserver should be wrapped in
flushSync
fromReactDOM
.Can we do this in
useMeasure
or at least add optional support forflushSync
inuseMeasure
. So that consumers can opt-in if they are using the dimensions for visual update(For eg. inuseLayoutEffect
).Link to code example: https://codesandbox.io/s/amazing-montalcini-j6lz46?file=/src/App.js
The text was updated successfully, but these errors were encountered: