Open olafvisker opened 7 months ago
Definitely a bug. As a workaround you can add a cooldown to the button as
const [canClick, setCanClick] = useState(true);
const handleToggle = () => {
if (canClick) {
onToggle();
setCanClick(false);
setTimeout(() => setCanClick(true), 700);
}
}
and/or you can dynamically adjust enableAnimateExpand
when you detect rapid clicking.
Description When using the AnimateExpand feature if you rapidly open and close a node this results in the droppable failing to reveal its children and it's height being locked to zero. This behavior is not exclusive to custom implementations and is reproducible in the basic examples provided on the documentation page (https://minop1205.github.io/react-dnd-treeview/?path=/docs/basic-examples-animateexpand--animate-expand-story).
To Reproduce
Expected Behavior When using enableAnimateExpand droppables should consistently reveal the children of a node regardless of the speed of node expansion and collapse actions.
Actual Behavior The bug manifests as the droppable failing to display the children after rapid opening and closing of a node. This behavior persists even in the basic examples provided in the documentation.
https://github.com/minop1205/react-dnd-treeview/assets/11807080/bbcfce71-47c8-425c-b7d9-d5d8840f3d69