Repository navigation
fix(sse): deliver library changes to the screens that cache the library list - #97
Merged
Merged
Conversation
…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.
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.
Why
SseChangeParserfiltered out every event whose name starts withLibrarybefore 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)ReadingStatsViewModelTrackerSettingsScreenMediaManagementScreenAll 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#1356fixed on iOS, whereDashboardView.handleSSEEventreloads everything forLibraryAdded/Changed/Deleted.What changed
LibraryAdded/LibraryChanged/LibraryDeletedare now parsed intoContentChange.Libraries(Created/MetadataChanged/Deleted), andSseContentSyncforwards 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 anunknownwould 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 toCONTENT_EVENT_PREFIXES; a payload without alibraryIdis ignored rather than escalated to a global reload (same rule as the book/series handlers). The dashboard needs no change —REFRESH_KINDSalready containsSseEventKind.Library.Verification
:app:assembleDebugon top of currentmain(which already has #95) — BUILD SUCCESSFUL.