-
Notifications
You must be signed in to change notification settings - Fork 1.3k
useLoadMore support in RAC Table #6538
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
Conversation
14591db
to
afd554c
Compare
## API Changes
unknown top level export { type: 'any' } @react-aria/loadinguseLoadOnScrollchanged by:
-
+useLoadOnScroll {
+ props: LoadOnScrollProps
+ ref: RefObject<HTMLElement | null>
+ returnVal: undefined
+} LoadOnScrollProps-
+LoadOnScrollProps {
+ isLoading?: boolean
+ onLoadMore?: () => void
+ scrollOffset?: number = 25
+} it changed:
|
going to unify the branches so there is only one PR to review |
* rough approach for having user provide loading element to rac collection element * bare minimum for table loader support * add first and last row/cell data-attributes * updating collection to auto propagate dependencies and debugging example stories * adding stories for empty state + loading variations in tree and table * updating verdaccio to not crash on newer macbooks * rip out first/last row and fix lint * add TableLoader to index so that I can test in s2 * add isTableEmpty and colspan for table loader also some debugging of crashes * add renderProps to loader * omit loader from the collection size in table * fix bugs with keyboard navigation and load more in table * Fix Tree keyboard nav issues and add tests * fix keyboard nav with loaders via keyboard delegate item filtering logic it makes more sense for the keyboard delegate to handle what keys should be returned on up/down/pageUp/etc * clean up and use hook for loader row attributes * refactor so that empty load more is expected to be a part of renderEmptyState * useLoadMore support in RAC Table (#6538) * initial implementation of load more hook * initial stab at scrollable body table * fix lint and readd content height change check * update attributes and test virtualizer + loadmore * remove option in prep for fix * fix for loadMore and update virtualized RAC table stories * get rid of loaderHeight option * move hook to separate package * add tests * fix some stuff from rebase * fix test for 16/17 * refactor useLoadOnScroll so it can replace useVirtualizer internals * inconsistent 19 test is fixed now * fix another 19 test * fix crash when dragging over loading spinner * only render loadmore spinner in dnd table if there are items * get rid of todo now that layout has been refactored * move logic to render after drop indicator when row is before logic into Collection * move useLoadMore to util package for now punting refactor and removal of virtualizer to later see note * pull loadmore hook out of rac table * rename loader collection element and update layout for variable loader height * forgot to remove deps * fix esm test? * update useloadmore logic and replace useVirtualizer internals note this removes the "wasLoading || ref.current.scrollHeight !== lastContentSize.current" portion of the logic. Previously useVirtualizer onVisibleRectChange was the one that would handle loading more items if opening a combobox dropdown during/after initial load, not the layouteffect. However, now that that is replaced by useLoadMore onScroll handler, we need the layouteffect to handle that * remove useVirtualizer * fix tests * fix erroneous conditional hooks call was causing a different order of hooks calls when a table with renderEmptyState went from empty to having a rows * review comments and updating Tree loader naming for consistency * dont apply width directly on columnheader if virtualizer fix for S2, the wrapper around the columnheader already has the calculated width applied on it so we dont need it on the columnheader as well. This makes padding values applied on the columnheader take up room from current width instead of making the columnheader extra wide * fix lint * add items check to useLoadMore interim fix to prevent some extra onLoadMore calls. RAC will eventually make use of the collection when the hook is moved inside the component whereas RSP table cant benefit from this since its collection is always rebuilt and thus non stable. Items are also provided to the TableBody and cant be accessed from with tablevirtualizer * add display contents and debug sticky loader * clean up from review * test and story updates from review comments --------- Co-authored-by: Devon Govett <devongovett@gmail.com>
Closes
✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Project:
RSP