-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat: Tree multiple level loading support and only count "items" for collection size #8349
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
base: main
Are you sure you want to change the base?
Conversation
… the top most collection
Build successful! 🎉 |
Build successful! 🎉 |
also the aria row index and pos in set from empty/isLoading state wrapper since it might be confusing to hear that there are items when the table/tree is empty
Build successful! 🎉 |
Build successful! 🎉 |
looks like you have some conflicts, happy to help resolve |
Build successful! 🎉 |
Build successful! 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approving for testing
setSize = getLastItem(siblings)!.index + 1; | ||
let lastItemOfParent = getLastItem(siblings)!; | ||
// Don't include loaders as part of the item count, to be revisited when we support focusing the loaders | ||
// Also assumes only one loader per tree parent row |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and assumes the loader is the last child. doesn't the tree item content node also count as a child of tree items? would it be safer to just count all the item children?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, thats true. Counting just the items should work, will update
let loaderNodeIndex = collectionNodes.indexOf(loaderNode); | ||
// Subtract by an additional 1 since we've already added the current item's height to y | ||
y += (loaderNodeIndex - lastProcessedIndex - 1) * rowHeight; | ||
let loader = this.buildChild(loaderNode, this.padding, y, null); | ||
nodes.push(loader); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this potentially reorder the loaders? This would put them all at the end, even if they were somewhere else within the collection originally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we only hit this point if we past the virtualizer's requested rect though right? At that point we only need/want to build and persist the loaders, and the order of these remaining loaders should be correct provided that iterating over the collection provides the nodes in their proper order
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my mental model for this flow is essentially:
- Iterate through the collection from the top.
- From
y=0
toy=requestedRect.y
, we build every loader and estimate the y increase for items - From
y=requestedRect.y
toy=requestedRect.maxY
, we build all loaders and items. Note that the loaders are removed fromloaderNodes
if they are built in step 2 or 3 - From
y=requestedRect.maxY
onwards, build the remaining loaders, increasingy
with an estimated rowHeight * number of items between each loader and its next loader
so theoretically the order of the loaders should be preserved right?
Build successful! 🎉 |
Build successful! 🎉 |
Closes RSP Component Milestones (view)
✅ Pull Request Checklist:
📝 Test Instructions:
Test Tree multiloading stories in RAC storybook. Also test all collections that support loading indicators (Table, Listbox, GridList, Tree, ComboBox, Picker, etc) and make sure that the virtualized items have the proper aria-rowcount/posinset/etc. Loaders shouldn't be counted as items/rows. Sanity check that other collections work fine virtualized/non-virtualized and that empty states/initial load states still render as expected
🧢 Your Project:
RSP