Skip to content
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

useDroppable changing state in useIsomorphicLayoutEffect forces a nested update #1368

Open
dinkinflickaa opened this issue Mar 20, 2024 · 0 comments

Comments

@dinkinflickaa
Copy link

dinkinflickaa commented Mar 20, 2024

The following line in useDroppable triggers a state change within a layout effect, leading to nested updates in React.

As per react docs:

The code inside useLayoutEffect and all state updates scheduled from it block the browser from repainting the screen. When used excessively, this makes your app slow. When possible, prefer useEffect.

You can observe the performance impact of altering state within a useLayoutEffect in this Codesandbox: https://codesandbox.io/p/sandbox/keen-mountain-scpydy-forked-tsk9sq?file=%2Fsrc%2Findex.js

Considering this, has anyone encountered performance issues due to useDroppable? Would moving state change to a useEffect compromise functionality? Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant