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

Nested folders: Paginate child folder items #70730

Merged
merged 2 commits into from
Jun 27, 2023
Merged

Nested folders: Paginate child folder items #70730

merged 2 commits into from
Jun 27, 2023

Conversation

ashharrison90
Copy link
Contributor

What is this feature?

  • extends pagination behaviour to child folder items
    • adjusts useLoadNextChildrenPage hook to return a function which requires the folder uid as the argument
      • this then allows for it to be called for different folders, not just the root folder for the page
      • handleLoadMore is passed the startIndex requesting the load. we can then find this item in the list, find the parentUID of this item and load more items from the correct parentUID 🥳
  • adjusts when pagination placeholders are added
    • before, these were only added at the root
    • now they are also added for child folders that are open whose collection isn't fully loaded
  • consolidates PAGE_SIZE and ROOT_PAGE_SIZE into 1 variable: PAGE_SIZE

Why do we need this feature?

  • better performance when opening a child folder

Who is this feature for?

  • anyone using nested folders

Which issue(s) does this PR fix?:

Fixes #70574

Special notes for your reviewer:

was expecting this to be much trickier... logic is very simple but seems to be working pretty well. still testing some edge case scenarios.

Please check that:

  • It works as expected from a user's perspective.
  • If this is a pre-GA feature, it is behind a feature toggle.
  • The docs are updated, and if this is a notable improvement, it's added to our What's New doc.

@ashharrison90 ashharrison90 added this to the 10.1.x milestone Jun 27, 2023
@ashharrison90 ashharrison90 self-assigned this Jun 27, 2023
@ashharrison90 ashharrison90 requested a review from a team as a code owner June 27, 2023 08:03
@ashharrison90 ashharrison90 requested review from joshhunt and L-M-K-B and removed request for a team June 27, 2023 08:03
Copy link
Contributor

@joshhunt joshhunt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat stuff. I've been playing around with it trying to break it but it seems to work pretty good!

Scrolling past an unloaded folder and then back up is a bit funky, but i'm not really sure there's much we can do about that - we would really need to know how many items are in a folder to get the proper amount of placeholders to prevent the weird scroll jumps.

I'm glad to see how straight forward this was to add on to what was there before 🎈

@ashharrison90 ashharrison90 merged commit 135ef08 into main Jun 27, 2023
20 checks passed
@ashharrison90 ashharrison90 deleted the ash/70574 branch June 27, 2023 10:38
harisrozajac pushed a commit that referenced this pull request Jun 29, 2023
* make handleLoadMore aware of child folders

* combine PAGE_SIZE and ROOT_PAGE_SIZE
harisrozajac pushed a commit that referenced this pull request Jun 30, 2023
* make handleLoadMore aware of child folders

* combine PAGE_SIZE and ROOT_PAGE_SIZE
@ricky-undeadcoders ricky-undeadcoders modified the milestones: 10.1.x, 10.1.0 Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pagination inside folders
4 participants