Skip to content

Fix "Show more" button display when more folder content exists - #6102

Open
LianaHarris360 wants to merge 1 commit into
learningequality:hotfixesfrom
LianaHarris360:fix-show-more
Open

Fix "Show more" button display when more folder content exists#6102
LianaHarris360 wants to merge 1 commit into
learningequality:hotfixesfrom
LianaHarris360:fix-show-more

Conversation

@LianaHarris360

Copy link
Copy Markdown
Member

Summary

This pull request resolves the bug that prevented the “Show more” button from appearing and loading additional content after opening a folder from the left sidebar, when the folder contains more than 25 resources. Opening the same folder from the main panel functioned as intended.

The implemented fix updates the timing of when the default sort order gets applied. Resource.where looks up a saved note that tells it "there is more after this”. IndexedDBResource.where fills in a default sort order when the caller didn't give one. IndexedDBResource.where was doing that on the caller's own object, and it ran after the lookup but before the note was filed. So the lookup saw no sort order and the filing saw one, and the two never matched.

Now the default is applied at the top of Resource.where, on a copy. The lookup and the filing see the same thing, so the saved note, that causes the “Show more” button to appear, is found.

This pull request also updates resources.spec.js with 4 new tests:

  • Checks that the more obj is returned when nothing is locally cached
  • A saved more obj is returned when the cache has exactly 1 full page
  • A more obj is not created if the server says that "more" does not exist
  • Returns the saved more obj, even if children have been removed (because it was saved either way). Note: If most of a folder’s resources are removed after the more obj was saved, the Show more button will show, with nothing to load. Clicking it does nothing, besides causing the button to disappear. The alternative to fix this causes the original bug to return.

Corrected behavior:

CorrectShowMoreBehavior.mp4

References

Fixes #6052

Reviewer guidance

To avoid building a folder with 25+ children, temporarily lower the max_results in actions.js:78 from 25 to 3, then use any folder with 3+ children.

  1. Open a channel that has a folder with enough subfolders to trigger pagination
  2. Navigate to that folder by clicking on it in the folder tree panel in the left sidebar, rather than clicking through the main content panel
  3. Scroll to the bottom of the list
  4. Ensure that the "Show more" button loads the next batch of resources and eventually disappears.

AI usage

I used Claude Code to help identify the root cause of the bug. I then implemented a fix, prompted Claude to review the code and tests, and iterated based on its feedback. I manually tested and checked the final output for correctness and removed any unnecessary changes before opening a PR.

…ied and call it before lookup. Adds tests covering a cached full page and the final page
@LianaHarris360 LianaHarris360 added bug javascript Pull requests that update Javascript code labels Aug 24, 2026
@marcellamaki marcellamaki self-assigned this Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug javascript Pull requests that update Javascript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Show More" button missing when loading folder children using tree panel

2 participants