fix: Sync no longer on leave study/background #20369
Open
Giyutomioka-SS wants to merge 3 commits intoankidroid:mainfrom
Open
fix: Sync no longer on leave study/background #20369Giyutomioka-SS wants to merge 3 commits intoankidroid:mainfrom
Giyutomioka-SS wants to merge 3 commits intoankidroid:mainfrom
Conversation
94fe464 to
f0f4e6d
Compare
AnkiDroid/src/main/java/com/ichi2/anki/deckpicker/DeckPickerViewModel.kt
Outdated
Show resolved
Hide resolved
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.
Purpose / Description
After returning from the study screen, onStartupResponse() was re-firing on every resume and triggering an unexpected sync. This fix prevents that by consuming the startup response after it's handled.
Fixes
Approach
When DeckPicker comes back to the foreground (e.g. after studying), the startup response flow re-emits and runs the startup code again, including auto-sync. The permissions branch already prevented this by clearing the response after use, but the success branch didn't. So after a long study session, coming back would trigger a sync again. Added the same "clear after use" line to the success branch so startup only runs once.
How Has This Been Tested?
Manually confirmed returning to deck list after study no longer triggers an unexpected sync.
Checklist
Please, go through these checks before submitting the PR.