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
Add Item fails the second time you call it every time, regardless of the call to setSelectedKeys. Might make sure you aren't creating two items with the same id?
Yeah, if you "add item" twice in succession in the codesandbox, I don't expect to see 2 items because the item with that id is already added.
This issue is about the item not being added at all if you first change the selection in the tree data state. The following video might help to illustrate the flow:
2022-07-11.09-25-22.mp4
Basically, there are two flows:
Click on "add item" once
All good, item with ID 8324823 is added
Alternatively:
Click on "select 1"
This calls setSelectedKeys to update the selection with the key 1
Click on "add item" once
Item with ID 8324823 isn't added, even though it doesn't already exist in the state
Took another look, appears to be related to StrictMode. If you remove StrictMode from the codesandbox, it works as expected. StrictMode is being addressed under the umbrella Issue #779
🐛 Bug Report
useTreeData
append stops working after selecting a key usingsetSelectedKeys
🤔 Expected Behavior
append
should work at all times😯 Current Behavior
append
quits working after an item is selected usingsetSelectedKeys
💁 Possible Solution
/
🔦 Context
I am trying to build a custom tree view component using the
useTreeData
hook💻 Code Sample
https://codesandbox.io/s/currying-https-vyq7ri?file=/src/App.tsx:363-364
🌍 Your Environment
The text was updated successfully, but these errors were encountered: