Skip to content

Lazy-load book page "Lists" section #10654

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

Merged
merged 2 commits into from
Apr 3, 2025

Conversation

jimchamp
Copy link
Collaborator

@jimchamp jimchamp commented Apr 2, 2025

Closes #10653

Replaces initial book page "Lists" section with a loading indicator. Whenever a patron scroll withing 200px of the "Lists" section, a /partials request is made for the section's content and the view is updated with the results.

If either the work or edition is on a list, the "See All" link becomes visible. This link was previously conditionally rendered, but is now always rendered with the hidden class.

Technical

Testing

Screenshot

Stakeholders

@codecov-commenter
Copy link

codecov-commenter commented Apr 2, 2025

Codecov Report

Attention: Patch coverage is 0% with 36 lines in your changes missing coverage. Please review.

Project coverage is 17.21%. Comparing base (2e231fa) to head (05e8590).
Report is 221 commits behind head on master.

Files with missing lines Patch % Lines
...nlibrary/plugins/openlibrary/js/book-page-lists.js 0.00% 27 Missing and 5 partials ⚠️
openlibrary/plugins/openlibrary/js/index.js 0.00% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10654      +/-   ##
==========================================
- Coverage   17.27%   17.21%   -0.06%     
==========================================
  Files          87       89       +2     
  Lines        4845     4861      +16     
  Branches      860      853       -7     
==========================================
  Hits          837      837              
- Misses       3477     3495      +18     
+ Partials      531      529       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

$if "lists" in ctx.features and not page.is_fake_record():
$# pages like /books/ia:foo00bar are fake records created from metadata API.
$# Adding them to lists doesn't work. Disabling it to avoid any issues.
$if "lists" in ctx.features and not page.is_fake_record():
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I moved this conditional such that it wraps the entire "Lists" section div. This was done to avoid rendering an entirely empty lists section on "fake record" pages (as seen below):

Screenshot 2025-04-01 155213
The border of the "Lists" section is present when the if statement is nested within the div

@github-actions github-actions bot added the Needs: Response Issues which require feedback from lead label Apr 3, 2025
@jimchamp jimchamp force-pushed the lazy-load-lists-section branch from eec7218 to 393a113 Compare April 3, 2025 16:33
Copy link
Collaborator

@cdrini cdrini left a comment

Choose a reason for hiding this comment

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

@cdrini cdrini merged commit 60dc0b8 into internetarchive:master Apr 3, 2025
5 checks passed
@cdrini cdrini self-assigned this Apr 3, 2025
@jimchamp jimchamp deleted the lazy-load-lists-section branch April 16, 2025 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Response Issues which require feedback from lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lazy-load book page "Lists" section
3 participants