Skip to content
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

Stop building list and wait for next page of children data to be loaded #58

Open
anark opened this issue Mar 28, 2021 · 0 comments
Open

Comments

@anark
Copy link

anark commented Mar 28, 2021

Hi there,
Thank you for the amazing library. I have an interesting issue I am trying to sort out with vtree.

I am trying to use vtree with an API that uses cursor based pagination. For example, at the root I would load all root items(files/folders). The API call would return the first 20 nodes as well as a hasNextPage variable.

If there is a next page I am trying to insert a placeholder that will then load the additional items when it is about to be loaded into the view. This seems like it will work fine.

The thing I can't figure out is how to do this inside the children of an item. If I load the first roots nodes children and it has 50 children but only the first 20 children of a folder are loaded and you are scrolling through you should not be able to see root nodes until all 50 of the children have been loaded and scrolled past. Is there a way to stop building the rest off the tree if and instead load the additional children before continuing to scroll the other root items? I tried adding an early return in the treewalker generator function, but this doesn't seem to work.

It is also very possible I am going about this all wrong. I'll try to make a diagram to make this explanation a bit clearer.

@anark anark changed the title Stop building list and wait for new data to be loaded Stop building list and wait for next page of children data to be loaded Mar 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant