dnd-kit: 'Maximum update depth exceeded' error with Sortable
Here is an example: https://codesandbox.io/s/dnd-kit-issue-eq952
https://user-images.githubusercontent.com/7955306/139406591-7a542b60-c578-485f-9058-8abe8f376e5b.mov
The problem is because of items filtering. But if we remove it we get empty space when move item out of the container
const filteredItems = activeId && isOutOfContainer ? items.filter((item) => item !== activeId) : items;
https://user-images.githubusercontent.com/7955306/139406934-653e5071-a45e-42fd-9d45-5c52222f8017.mov
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 7
- Comments: 24 (1 by maintainers)
Again, something about this seems horribly wrong, but the idea is that you break the recursion by delaying the call to
setState
. The same thing would probably work withsetImmediate
/setTimeout(..., 0)
.Simple example of a component that would break due to exceeding the stack limit:
You can break the recursion this way:
Here’s a quick CodePen to demonstrate: https://codepen.io/pattrn/pen/BaMzERM.
It’s difficult for me to give an exact example from the documentation, since I ported everything over to MobX and did significant refactoring, so there’s no longer an easy one-to-one comparison.
Prolly this issue shouldn’t be closed then
Getting the same issue; same error with <Accessibility>.
Hey, @clauderic I still have the error at your link Plise check it. https://user-images.githubusercontent.com/7955306/148953660-4b38083c-bc09-463e-9daf-37625f3ca0b8.mov
@clauderic I checked the forked sandbox aswell and was able to replicate it. Imo this should be opened again.
Error-Gif
@Dm1Korneev @clauderic I can confirm.
I’m also experience
Maximum update depth exceeded
in the forked codesandbox project.There is also error in
Accessibility
component:Memoize your objects, so you don’t pass a new ref every time, which causes the DOM tree to refresh.
This is a problem throughout the code. For instance, you are also creating a new Object, and therefore passing a new ref, every time you compute your props inside
SorteableItem
.