Conversation
|
Thanks for the PR. We had a chance to discuss this as a team today. We have a few changes we'd like to propose. We think the name could be confusing (and we may change our minds on this one a few times), right now the only proposed one is We also want to do this and match the API in useListData. Of note, this may be solved eventually in useAsyncTree. Or it could be solved today by implementing something like optimistic updates. We are also a little wary because a function such as |
|
thanks for replying,
Is that something you would like me to attempt to add in this PR? |
|
If you have the time, that would be super helpful. But I also understand if this is as far as you want to take it. |
# Conflicts: # packages/@react-stately/data/test/useTreeData.test.js
|
Going to close this for now. If someone wants to pick it up again, ideally the API would change to |
The immutable nature of the useTreeData's items means I couldn't find a way to re-initialise a list with new data returned from a subsequent API call.
This PR adds a new method to the list called
replaceAllwhich will replace all items from the tree with those specified in the function call.✅ Pull Request Checklist:
📝 Test Instructions:
The tests cover how it works, if you need to test in a component then I'm using it as :