Skip to content

Efficient lazy loading in nested Tree components with useAsyncList #8668

Answered by snowystinger
zaru asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, thanks for the discussion. You should be able to use the context to get the Tree state in order to know if an item is expanded or not. https://react-spectrum.adobe.com/react-aria/Tree.html#advanced-customization

I see you're using the recently released "LoadMoreItem"
See https://react-spectrum.adobe.com/releases/2025-07-22.html and more specifically https://react-spectrum.adobe.com/react-aria/Tree.html#asynchronous-loading

My guess is that you need loader items in the child items, not just the one at the root. Can you make it match the example a bit more closely, breaking up the async list call so it can independently fetch directories? then put those calls into the items with their o…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@zaru
Comment options

@snowystinger
Comment options

@LFDanLu
Comment options

LFDanLu Aug 4, 2025
Collaborator

@zaru
Comment options

Answer selected by zaru
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants