fix: fixes bug where cannot expand when dropping on empty children#70
fix: fixes bug where cannot expand when dropping on empty children#70AssisrMatheus wants to merge 1 commit into
Conversation
|
Hi @AssisrMatheus, thanks for your contribution! Can you please explain which issue you are facing? The prop |
Ah this is not very clear! 💡 Perhaps you can introduce another variable |
|
Also, it seems like when you provide |
|
It can be fixed if you implement your own data provider, for exmaple: const dataProvider = new StaticTreeDataProvider(dataUsageTree, (item, data) => ({ ...item, data }));
dataProvider.onChangeItemChildren = function (itemId, newChildren) {
this.data.items[itemId].hasChildren = newChildren.length > 0;
this.data.items[itemId].children = newChildren;
this.onDidChangeTreeDataEmitter.emit([itemId]);
};
return (
<div>
<UncontrolledTreeEnvironment
dataProvider={dataProvider}
canDragAndDrop={true}
canReorderItems={true}
canDropOnItemWithChildren={true}
canDropOnItemWithoutChildren={true}
viewState={{}}>
...
</UncontrolledTreeEnvironment>
</div>
) |
Usually items starts without children, so the collapse arrow is not displayed as expected. But when dragging into one of those items, adding children to them, the
hasChildrenflag is not updated, so the arrow still doesn't show up, even thought the item now have children. And then you cannot expand to see its children