-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow async tree walkers? #37
Comments
On second thought, I think it should be possible within react-vtree as is: e.g. I could start fetching data when node is expanded, then once it’s finished update my structure with newly received child node data and run |
Hi @strogonoff, sorry for long delay. According to the I'm going to prepare an example for it, so it may be more descriptive. I'll publish it here as well. |
Understood. That’s the idea I arrived at in the end: when node is expanded, start data query somewhere else and pass If I finish this component I’m building with react-vtree soon enough, I’ll try to contribute an example as well… |
Example use case: I’m reading object data from an async source. I could optimize initial load time by only reading data for top-level nodes at first. Then, when a node is opened, I would fetch child node data by querying my async source—however, that means the walker must be asynchronous.
The key point I think is potential
await iter.next()
around here. Tree computer might then have to become async as well, and there would need to be some logic for handling delayed opening of nodes (with some sort of “is loading” boolean prop?).I wonder whether async tree walkers are on the radar, or perhaps I’m missing some way of addressing this challenge that doesn’t require asynchronous walkers🤔
The text was updated successfully, but these errors were encountered: