Skip to content

TT-7494 Offline to online sync didn't run.#422

Merged
gtryus merged 1 commit into
developfrom
TT-7494
Jul 13, 2026
Merged

TT-7494 Offline to online sync didn't run.#422
gtryus merged 1 commit into
developfrom
TT-7494

Conversation

@sarahentzel

Copy link
Copy Markdown
Collaborator

possible race condition: wait for the backup restore to be done before checking projects loaded

possible race condition: wait for the backup restore to be done before checking projects loaded

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses TT-7494 by eliminating a startup race where “Go Online” could trigger ITFSYNC before the IndexedDB backup restore finished, causing offlineproject-based filtering to run against an empty in-memory cache.

Changes:

  • Ensure ITFSYNC waits for restoreBackup to finish on Electron online startup so offlineproject records are present in memory.
  • Make the IndexedDB→memory “refill” logic idempotent by updating existing records instead of throwing on duplicates, and add coverage for that behavior.
  • Improve robustness when determining export/import baseline dates and offline project selection by falling back to direct memory/backup queries when React-closure reads are stale.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/renderer/src/store/importexport/electronExport.tsx Adds fallback queries for offlineproject timing and ensures needed records are present for ITFSYNC/FULLBACKUP filtering.
src/renderer/src/Sources.tsx Awaits restoreBackup before running ITFSYNC during Electron online startup to prevent an empty-memory race.
src/renderer/src/crud/syncToMemory.ts Makes backupToMemory idempotent by updating existing records instead of failing on addRecord.
src/renderer/src/crud/syncToMemory.test.ts Adds a unit test validating backupToMemory updates an existing record without throwing.

@sarahentzel sarahentzel requested a review from gtryus July 13, 2026 20:02
@gtryus gtryus merged commit 39269a0 into develop Jul 13, 2026
3 checks passed
@gtryus gtryus deleted the TT-7494 branch July 13, 2026 21:27
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.

3 participants