Repository navigation
fix(dashboard): re-read the whole dashboard when read state moves a book - #96
Merged
Merged
Conversation
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.
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.
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.reloadwith 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 leaveskeepReading, appears inrecentlyReadBooks, and theonDeckpointer 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.READ_STATUS_SECTIONSis gone (no targeted read-state set remains);READ_STATE_CARD_SECTIONSstill 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, andreadListsInProgress(which the read state feeds) comes along.Verification
./gradlew :app:compileDebugKotlinand:app:assembleDebugpass.onDeckadvances, and the same happens when the change is made on another device.