Skip to content

fix(sse): deliver library changes to the screens that cache the library list - #97

Merged
dyphire merged 1 commit into
mainfrom
fix/sse-library-events
Nov 28, 2026
Merged

dyphire merged 1 commit into
mainfrom
fix/sse-library-events

Conversation

@dyphire

@dyphire dyphire commented Nov 28, 2026

Copy link
Copy Markdown
Member

Why

SseChangeParser filtered out every event whose name starts with Library before parsing, on the assumption that the dashboard re-read libraries itself. The dashboard has no library section, and the five consumers that do care never heard anything:

  • BrowseViewModel (library scope selector)
  • DownloadViewModel (library filter)
  • ReadingStatsViewModel
  • TrackerSettingsScreen
  • MediaManagementScreen

All of them subscribe to librariesChanged(). A library added, renamed or removed on another device therefore left these screens on a stale list until a manual reload.

This is the Android counterpart of the same class of bug kmworks/kmreader#1356 fixed on iOS, where DashboardView.handleSSEEvent reloads everything for LibraryAdded/Changed/Deleted.

What changed

LibraryAdded / LibraryChanged / LibraryDeleted are now parsed into ContentChange.Libraries (Created / MetadataChanged / Deleted), and SseContentSync forwards that kind straight to the bus instead of folding it into the batched reload — carrierOf() has no carrier for a library, and turning it into an unknown would make every observing screen re-read for something only a few of them care about. It behaves like the gap signal: each screen decides whether it observes libraries.

"Library" is added to CONTENT_EVENT_PREFIXES; a payload without a libraryId is ignored rather than escalated to a global reload (same rule as the book/series handlers). The dashboard needs no change — REFRESH_KINDS already contains SseEventKind.Library.

Verification

:app:assembleDebug on top of current main (which already has #95) — BUILD SUCCESSFUL.

…ry list

SseChangeParser dropped every event whose name starts with "Library" before
it ever reached the shared parser, with a comment claiming the dashboard re-read
libraries on its own. It does not: the dashboard has no library section, and the
five consumers that actually care — the Browse scope, the download filters,
reading stats, the tracker settings screen and media management — subscribe to
librariesChanged() and never heard a word. Adding, renaming or removing a library
on another device left those screens showing the old set until a manual reload.

A library is configuration, not a row, so it does not fit the batched reload the
other kinds go through (carrierOf() has no carrier for it, and folding it in as
an unknown would make every observing screen re-read for something that only
matters to a few). It is now parsed into ContentChange.Libraries and forwarded
straight to the bus, exactly like ContentChange.Unknown from a gap signal: every
screen decides for itself whether it observes libraries at all.

The three events map onto what Komga reports: LibraryAdded/LibraryDeleted carry
a libraryId, LibraryChanged is a metadata edit (name, path, unavailable flag) and
takes the MetadataChanged kind. Payloads without an id are ignored rather than
turned into a global reload — the same rule the book and series handlers use.
@dyphire
dyphire merged commit ce861f7 into main Nov 28, 2026
1 check passed
@dyphire
dyphire deleted the fix/sse-library-events branch November 28, 2026 16:04
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.

1 participant