Skip to content

fix(dashboard): re-read the whole dashboard when read state moves a book - #96

Merged
dyphire merged 1 commit into
mainfrom
fix/dashboard-read-state-refresh
Nov 28, 2026
Merged

dyphire merged 1 commit into
mainfrom
fix/dashboard-read-state-refresh

Conversation

@dyphire

@dyphire dyphire commented Nov 28, 2026

Copy link
Copy Markdown
Member

Problem

Marking a book (or series) read/unread — or reading on another device — did not move the dashboard's keepReading, onDeck and recentlyReadBooks sections. The strips that only change a field (recentlyAddedBooks, recentlyReleasedBooks) updated normally, which is what made it look like nothing was refreshing.

Cause

The dashboard refresh for read state was routed through the targeted section re-read (revalidateSections → PagedFeed.reload with the pages already on screen). That is a field-level correction: it re-reads the rows that are already there. A read-state flip is a membership change — the book leaves keepReading, appears in recentlyReadBooks, and the onDeck pointer moves to the next book of its series. A window containing only pre-existing rows can never show a row arriving or leaving, so those three sections stayed frozen. iOS re-reads the whole read-status set for the same reason.

Change

DashboardViewModel:

  • ContentChangeKind.ReadStateChanged / ProgressChanged (book and series) → full reload instead of a targeted set.
  • SseEventKind.ReadProgress (remote) → full reload too, so local and remote behave the same for the same logical change.
  • Metadata changes keep the targeted book/series re-read: they patch fields, not membership.
  • READ_STATUS_SECTIONS is gone (no targeted read-state set remains); READ_STATE_CARD_SECTIONS still drives the in-place progress patch of the recent cards.

Cost control is unchanged: the local channel debounces 500 ms, the SSE channel aggregates over 5 s, so a reading session's page-by-page reports collapse into one reload. The reload keeps its window depth (feed.reload(previousItems, keepPages)), so contents are replaced without resetting scroll, and readListsInProgress (which the read state feeds) comes along.

Verification

  • ./gradlew :app:compileDebugKotlin and :app:assembleDebug pass.
  • On device: marking a book read moves it out of keepReading and into recentlyReadBooks, onDeck advances, and the same happens when the change is made on another device.

keepReading, onDeck and recentlyReadBooks did not move when a book was marked
read/unread or read on another device, while the strips that only change a field
(latest books, recently released) updated normally.

The refresh was routed through the targeted section re-read, which re-reads the
window already on screen (feed.reload with the shown pages). That is a
field-level correction and cannot observe membership: a read-state flip is a
membership change — the book leaves keepReading, appears in recentlyReadBooks,
and the onDeck pointer moves to the next book of its series. A window that only
contains rows which are already there can never show a row arriving or leaving,
so those three sections stayed exactly as they were. iOS re-reads the whole
read-status set for the same reason; this is that request.

Both channels now take the full reload for read state and progress (book and
series, and the remote ReadProgress event): the dashboard's 500 ms local window
and 5 s SSE window collapse a reading session's page-by-page reports into one
reload, and the reload keeps its window depth (feed.reload with the previous
pages), so the section contents are replaced without resetting scroll. The
readListsInProgress strip, which the read state feeds, comes along.

Metadata changes keep the targeted book/series re-read: they patch fields, not
membership.
@dyphire
dyphire merged commit 8a3de76 into main Nov 28, 2026
1 check passed
@dyphire
dyphire deleted the fix/dashboard-read-state-refresh branch November 28, 2026 14:42
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