Repository navigation
perf: lazy-load book covers in the search results - #16
Merged
Merged
Conversation
The results grid shows up to 36 books per page, and every cover was downloaded as soon as the page rendered. Covers now use native loading="lazy", so the browser only fetches those near the viewport, and decoding="async" so decoding does not block rendering. The cover on the book detail page and the logo stay eager: they are visible as soon as the page opens. Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 41 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The book search results show up to 36 books per page (9 by default), and every cover image was downloaded as soon as the page rendered, including those far below the fold.
The cover
<img>inbook.tsnow has:loading="lazy": the browser only fetches covers that are near the viewport.decoding="async": image decoding does not block rendering.These are native browser attributes, with no extra code or dependency.
The cover on the book detail page and the sidebar and login logos are unchanged. They are visible as soon as the page opens, so lazy-loading them would only delay them.
Checks
pnpm format:check,pnpm lint,pnpm build: passpnpm test: 22/22 tests pass🤖 Generated with Claude Code