-
Notifications
You must be signed in to change notification settings - Fork 27
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
Use flat structure from GraphQL query directly, avoid duplicating data #354
Comments
Probably a follow-up for #345 as this would take a bit to implement, and I suspect this is not on the roadmap for 0.2. |
Reading the The constructor then calls |
The only simple option that I found without having to hack the library, was the The first function is used to tell the library whether it needs to load nodes or not. The second function loads nodes dynamically. Internally, I cannot see any call to the If we manage to get the data from GraphQL in a flat structure, already in order as it should be displayed, then we may just need to hook it up with the |
The So the first GraphQL query could result in an Then every time the We would need a watcher in the
When we are updating it, we can selectively skip state too, like not touching the |
Thanks to @dwsutherland just found an easier way to find the cycle points. workflows {
cyclePoints: familyProxies(ids: ["root"]) {
cyclePoint
}
} 🎉 thanks @dwsutherland ! |
Second improvement by @dwsutherland to our GraphQL query to retrieve the tree view data:
We don't need the |
I think this can be closed now? The code on |
@oliver-sanders - can you confirm and close? |
Describe exactly what you would like to see in an upcoming release
PR #345 aims to improve the performance by keeping less items in the DOM, with a virtual scroller. The scroller is a Vue library. The library that does the magic of keeping less items in the DOM (using a view approximately the size of your current window viewport, with a buffer) is called Infinite Tree.
When you use the Infinite Tree, you provide a data structure with hierarchy. It then uses
flattree
library, maintained by the same developer.flattree
, as per its name, simply gets the hierarchical data and returns a flat list.The nodes in the list are in order, and contains certain attributes required to display them in the Infinite Tree.
Our current problem with this approach is that our GraphQL query may result in a large JS object in memory. And having this data duplicated by the Infinite Tree is not really the best scenario performance-wise.
So this issue is to investigate possible ways to avoid it.
Additional context
The hierarchical data structure is pretty close to what we had before:
Here's the constructor called when we provide the Infinite Tree object with a hierarchical data structure: https://github.com/cheton/infinite-tree/blob/7bf037ee79b8aa702f5ee605b8ec218bab2533b4/src/infinite-tree.js#L311
At the end of the method, it will call
loadData
, defined here: https://github.com/cheton/infinite-tree/blob/7bf037ee79b8aa702f5ee605b8ec218bab2533b4/src/infinite-tree.js#L1038loadData
is callingflatten
from theflattree
library.Here's what the flat tree structure looks like:
The challenges here are:
gist with some example GraphQL data and the data used internally by the
InfiniteTree
(afterflattree
was used).Pull requests welcome!
The text was updated successfully, but these errors were encountered: