Skip to content

Library stays stale for up to 5 minutes after a status change made outside it, and an edit there can save the old status back #225

Done

Description

@zhollis21

Raised by Copilot's review of #224 (#103, the Up Next sheet), which widens a gap that was already there.

Problem

The Library tabs skip reloading for five minutes after a successful load:

// src/AniSprinkles.Core/PageModels/MediaListPageModel.cs
private static readonly TimeSpan ListRefreshInterval = TimeSpan.FromMinutes(5);
...
var isFresh = _lastSuccessfulLoadUtc != default &&
    DateTimeOffset.UtcNow - _lastSuccessfulLoadUtc < ListRefreshInterval;

Only a change made from the Library forces a reload: its EntryActionCoordinator host passes OnEntryStatusChangedAsync = _ => LoadAsync(forceReload: true) (MediaListPageModel.cs:217). Every other surface that saves a list entry updates only its own cards:

  • Discover, Browse and Search hosts: OnEntryStatusChangedAsync = entry => { ApplyEntryToItems(entry); ... } (DiscoverPageModel.cs:93, MediaBrowsePageModel.cs:91, SearchPageModel.cs:97).
  • The media details page saves through AniList.SaveMediaListEntryAsync directly and tells no one.
  • The Up Next sheet (Offer to add the next season/related entries when you complete a series #103) moves other titles (Paused → Watching, Completed → Rewatching, …) from any of those surfaces.

So after a status change made anywhere but the Library, the Library can show the title in its old section for up to five minutes. That is worse than cosmetic: long-pressing the stale card and editing it (progress, rating) saves the whole entry, old status included, and undoes the change.

Impact

  • Display: a title shows in the wrong section until the window lapses or the user pulls to refresh.
  • Data: an edit made from the stale card writes the old status back to AniList.

Options

Not settled; for kickoff.

A. A shared "list changed" signal. A small singleton that every successful list save notifies (coordinator hosts, the details page, Up Next); the Library treats a notification as "stale" and reloads on its next appearance. One place to call, testable in Core. Needs every save path to remember to call it.

B. Hook it below the page models. CachingAniListClient already sees every SaveMediaListEntryAsync / DeleteMediaListEntryAsync; it could raise the signal itself, so no call site can forget. Couples the cache decorator to page-level freshness.

C. Patch the Library's copy in place from the saved entry instead of reloading. Cheapest in requests, but it re-implements sectioning outside the loader.

Leaning B (or A fed from B), since a forgotten call site is exactly how this gap appeared. A hypothesis, not a decision.

Constraint

Related

Activity

  1. added
    bug
    p2-high
    on Nov 21, 2026
  2. zhollis21 commented on Nov 22, 2026

    @zhollis21
    OwnerAuthor

    Decided during planning (with #227's last journey, one branch): option B. CachingAniListClient bumps a new ListChangeTracker counter after every save that succeeds and every removal that reports success. Each Library half records the counter at load, and the freshness window holds only while the counter is unchanged, so the next appearance after an outside change reloads (2 requests: viewer and list), never once per save. The Library's own +1, rating and progress saves absorb their own bump, because their cards already show the change. A counter rather than a flag, so the Anime and Manga lists each notice the same change. C (patching in place) was rejected: a reload already updates the sections in place through MediaListSectionsMerger.Merge, so the only saving would be requests, at the cost of a second copy of replay's sectioning logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugp2-high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions