Repository navigation
fix(study-options): act on the deck the panel shows - #22847
Conversation
Rebuild, Empty and Unbury acted on the collection's selected deck, while the panel's other actions use the deck it shows. If the panel was out of date, for example after a failed refresh, they could act on a deck that wasn't shown. They now act on the shown deck. Assisted-by: Claude Opus 5.5
|
Snapshot diff report vs
All 3 changed screenshotsCardBrowserScreenshotTest
|
mikehardy
left a comment
There was a problem hiding this comment.
Assisted-by: grok-4.7
Thank you. Matching these three actions to Custom study, Deck options, and Reminders is the right cut, and the regression tests actually change the collection selection after the panel has captured its deck.
Locally I rebased the single commit onto current main and did not force-push. Lint (lintAll, ktlintCheck, lint-rules:test), unit (jacocoUnitTestReport), and emulator (TEST_RELEASE_BUILD=true via run_emulator_tests.py on emulator-5556 / API35_GAPI) all passed on the rebased tip.
selectedDeckId is flowOfSelectedDeckId.value, initial 0L. The only writer is Collection.updateStateFromCollection(), which assigns study.deckId from decks.current(). refreshData() is withOpenColOrNull { updateStateFromCollection() }; a closed collection leaves the previous id in place. rebuildCram and emptyCram run under progressManager.withProgress, then undoableOp { sched.rebuildFilteredDeck(selectedDeckId) } or emptyFilteredDeck(selectedDeckId), then withCol { updateStateFromCollection() }. unbury launches on viewModelScope and only runs undoableOp { sched.unburyDeck(selectedDeckId) }. The new empty, rebuild, and unbury tests set up deck divergence after refresh and assert only the captured deck changes.
some acceptable findings, no action required, just leaving for posterity: after Empty or Rebuild, updateStateFromCollection() still reads decks.current(); unbury() still does not refresh haveBuried or the study state.
Screenshot changes have been detected, so leaving this for a good manual look.
|
Great catch |
Note
Assisted-by: Opus 5.5
Purpose / Description
In study options, Rebuild, Empty and Unbury acted on the collection's selected deck instead of the deck the screen shows. If the screen was out of date, they could act on a deck that wasn't shown.
Fixes
Approach
They now use the shown deck (
selectedDeckId), like Custom study, Deck options and Reminders already do.How Has This Been Tested?
tests only
Learning (optional, can help others)
NA
Checklist
Please, go through these checks before submitting the PR.