Skip to content

fix: Sync no longer on leave study/background #20369

Open
Giyutomioka-SS wants to merge 3 commits intoankidroid:mainfrom
Giyutomioka-SS:sync-interval-on-exit-19854
Open

fix: Sync no longer on leave study/background #20369
Giyutomioka-SS wants to merge 3 commits intoankidroid:mainfrom
Giyutomioka-SS:sync-interval-on-exit-19854

Conversation

@Giyutomioka-SS
Copy link
Contributor

@Giyutomioka-SS Giyutomioka-SS commented Feb 27, 2026

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.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

@Giyutomioka-SS Giyutomioka-SS changed the title fix: Sync no longer on leave study/background fix: 10-min auto-sync interval on exit from deck list Feb 27, 2026
@Giyutomioka-SS Giyutomioka-SS changed the title fix: 10-min auto-sync interval on exit from deck list fix: Sync no longer on leave study/background Feb 27, 2026
@Giyutomioka-SS Giyutomioka-SS force-pushed the sync-interval-on-exit-19854 branch from 94fe464 to f0f4e6d Compare February 28, 2026 00:04
Copy link
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great diagnostics!!

Is it feasible to handle this inside the ViewModel?

Could you also add a test, or a @NeedsTest

@david-allison david-allison added the Needs Author Reply Waiting for a reply from the original author label Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Author Reply Waiting for a reply from the original author Needs Review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sync is triggered when leaving the study screen

2 participants