Skip to content

fix(mangareader): resolve lazy-loaded covers - #727

Merged
kkantan merged 2 commits into
Aidoku-Community:mainfrom
at-wr:codex/mangareader-lazy-thumbnails
Aug 29, 2026
Merged

fix(mangareader): resolve lazy-loaded covers#727
kkantan merged 2 commits into
Aidoku-Community:mainfrom
at-wr:codex/mangareader-lazy-thumbnails

Conversation

@at-wr

@at-wr at-wr commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • resolve MangaReader listing and home covers through the template's existing lazy-image helper
  • prefer data-lazy-src, data-src, and data-url before placeholder src values
  • cover the precedence with a host unit test and a full Aidoku HTML parser fixture

MangaMura currently emits a one-pixel GIF in src and the actual CDN cover in data-src. Direct src reads therefore produce transparent listing thumbnails even though details and reader images work. Reusing one helper across every MangaReader cover path fixes the template without adding per-entry detail requests.

Verification

  • cargo fmt --check in templates/mangareader
  • cargo test --target aarch64-apple-darwin (1 passed)
  • cargo test --no-run (Wasm fixture compiles)
  • cargo clippy -- -D warnings in templates/mangareader
  • cargo test --no-run, cargo clippy -- -D warnings, and cargo build --release in sources/ja.mangamura
  • live MangaMura homepage HTML rechecked with placeholder src plus real data-src covers

@kkantan kkantan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the version numbers for mangareader sources should also be incremented so that this change shows as an update for users.

Comment thread templates/mangareader/src/helper.rs Outdated
Comment on lines +7 to +17
fn preferred_image_attr(mut attr: impl FnMut(&str) -> Option<String>) -> Option<String> {
[
"abs:data-lazy-src",
"abs:data-src",
"abs:data-url",
"abs:src",
"data-url",
]
.into_iter()
.find_map(&mut attr)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think this new implementation is necessary, since it appears to be the same logic but somewhat more abstracted, in a way that doesn't really make sense.

Comment thread templates/mangareader/src/parser.rs Outdated
use aidoku_test::aidoku_test;

#[aidoku_test]
fn manga_list_prefers_lazy_loaded_cover() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think maintaining tests like these can be annoying since selectors are prone to changing, and it's not clear what input the parse_manga_list function requires while testing. anyways, the change is small enough that I don't think it really warrants tests.

@at-wr

at-wr commented Aug 29, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the requested version bump in a951608: Manga Mura is the only source currently depending on the mangareader template, and its source version is now 3. I also removed the abstraction and selector tests called out in the inline review. Ready for another look.

@at-wr
at-wr requested a review from kkantan August 29, 2026 12:30
@kkantan
kkantan merged commit 3677f4c into Aidoku-Community:main Aug 29, 2026
2 checks passed
@at-wr
at-wr deleted the codex/mangareader-lazy-thumbnails branch August 29, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants