Book cover not displayed immediately after adding to a list
Problem
When a book is added to a list from a book/edition page, the newly added list entry initially displays the generic book placeholder icon instead of the book's cover.
Refreshing the page causes the actual book cover to appear.
When you refresh it actually shows the book icon
Reproducing the bug
- Steps to reproduce
- Open a book that has a cover.
- Click Want to Read drop down and in
My Reading Lists:Add the book to any existing list. - Observe the list entry shown immediately after adding the book.
- Refresh the page.
- Compare the list entry before and after the refresh.
Expected behavior
- The book cover should be displayed immediately after adding the book to a list, without requiring a page refresh.
Actual behavior
Immediately after adding the book:
- A generic book icon is shown.
After refreshing the page:
- The actual book cover appears.
Proposed improvements
- Render/use the book's cover when the list entry is inserted, instead of initially using the generic placeholder.
- Preserve the existing placeholder behavior when a book genuinely has no cover.
Acceptance criteria
- [ ] Adding a book to a list immediately displays its cover when available.
- [ ] Books without covers continue to display the default book icon.
- [ ] The cover is vertically aligned with the list text.
- [ ] Refreshing the page does not change the visual representation of the newly added list item.
- [ ] Existing list add/remove behavior continues to work.
Context
- Browser (Chrome, Safari, Firefox, etc): Brave
- OS (Windows, Mac, etc): Fedora
- Logged in (Y/N): Y
- Environment (prod, dev, local): prod
Breakdown
Implementation Details (for maintainers)
Requirements Checklist
- [ ]
Related files
Stakeholders
Instructions for Contributors
- Please run these commands to ensure your repository is up to date before creating a new branch to work on this issue and each time after pushing code to Github, because the pre-commit bot may add commits to your PRs upstream.
Thank you @CipherZ3r0 for submitting this issue!
⚠️ Contributors, this issue will be ready to work on once:
- [ ] Triage — maintainers will add
Priority: *andLead: @* - [ ] Needs: Breakdown — issue lacks concrete implementation steps
Context
- The bug traces to a specific line of client-side code. When a book is added to a list via the "Want to Read" dropper,
ReadingLists.js#L163-L171storescoverUrlfrom the dropdown element'sdata-list-cover-urlattribute, whichdropper_lists.html#L7populates fromlist.get('cover_url')— the list's own cover, not the cover of the item being added. If the list has no cover of its own, this falls back to the generic placeholder. - That (wrong) value is then passed straight to
attachNewActiveShowcaseItematReadingLists.js#L236-L240, which renders the new showcase entry viaShowcaseItem.js#L299-L311using that cover. - This is confirmed by contrast: on a normal (refreshed) page load,
my-books/index.js#L53-L61builds each showcase item's cover by deriving the OLID from the seed's own key (https://covers.openlibrary.org/b/olid/{OLID}-S.jpg), which is why the correct cover appears after a refresh. - Separately, and likely unrelated to this specific report but in the same code path:
ReadingLists.js#L338setsdata-list-cover-url="${listKey}"(the list's key, not a URL) when a brand-new list's dropdown affordance is created — worth a look while in this area. - No duplicate issue or open PR was found addressing this specific behavior. #13170 ("Want-to-read list has 'blank entries'") is in the same general area (My Books / list showcase rendering after an action) but describes a different symptom.
Issue Assessment
Open questions
- For subject-type seeds (which have no OLID and therefore no derivable cover, per
getSeedType()inShowcaseItem.js), what should the immediately-added showcase item's cover fall back to? This needs a maintainer/implementer call.
Action items
- [ ] Confirm the fix approach before implementation begins: have
modifyList's "adding" path derive the cover from the seed being added (mirroring the OLID-based logic already used inmy-books/index.js) rather than fromthis.patronLists[listKey].coverUrl(the list's own cover).
Suggested breakdown
- [ ] Change the "add to list" path in
ReadingLists.jsto pass the seed's own cover (not the list's cover) toattachNewActiveShowcaseItem. - [ ] Handle seed types that lack an OLID-derivable cover (subjects) with an explicit, deliberate fallback.
- [ ] Confirm the true "no cover" case (book genuinely has no cover) still falls back to the placeholder correctly.
- [ ] Add/adjust JS test coverage for
ReadingLists.js/ShowcaseItem.jsaround cover selection.
🔔 Stakeholders
@ragipidavid — the Lead: @ragipidavid label is described as covering "List Showcase & Follow Activity Feed," and this bug is specifically in the list showcase rendering path (ShowcaseItem.js, ReadingLists.js).
Full triage checklist
- [x] Triage — correct labels applied or removed
- [x] Problem / opportunity — problem is clear, audience identified, actionable
- [x] Scope — issue is well-scoped; does not try to do too many things
- [x] Justification — reasoning and impact stated; sufficient for leads to prioritize
- [x] Success & testing criteria — defines what "done" looks like, verifiable by a contributor
- [ ] Proposal & breakdown — concrete plan present; checklist actionable for a contributor
- [x] If bug: environment & repro steps — browser, version, local vs prod; steps to reproduce
- [x] Risks, concerns, open questions — identified and surfaced
- [x] Richy context — relevant code, commits, PRs reviewed; no duplicate found
- [x] References — screenshots, designs, docs, and links present where needed
[!NOTE] This comment was automatically generated by Richy, Open Library's issue enrichment assistant, on behalf of @mekarpeles. This is NOT a sign-off. This issue needs lead review before work begins.
@CipherZ3r0 good luck with this one. I hope it's not too hard to reproduce locally. I def recommend asking AI questions about the codebase if you get suck. opencode has a great free tier!
@RayBB I tried reproduce this issue multiple times but locally it's entire behavior is different.
in prod:
- When a book is added to a list, the list cover doesn't appear immediately; I have to reload the page before the cover is shown.
- Once loaded, the list cover appears to be the cover of the book that originally created/owns the list.
Locally:
- The list cover appears immediately without a page reload.
- The list cover is based on whichever book page I'm currently viewing.
- For example, if books A and B are both in the same list, opening A shows A's cover for the list, while opening B shows B's cover for that same list.
So I'm not sure whether this is caused by differences in my local environment/setup, or whether the behavior has changed in the current codebase since the issue was reported.
@CipherZ3r0 thanks for trying to reproduce it. I also really don't know how it can be reproduced since there are many factors at place including potentially caching at various levels.
Do you have any sense of where in the system this could bubbling up? Is there anywhere along the code path that has caches that may cause it to happen on production but not locally?
If anyone else wants to try this, would be helpful.