Conversation
possible race condition: wait for the backup restore to be done before checking projects loaded
Contributor
There was a problem hiding this comment.
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
restoreBackupto finish on Electron online startup soofflineprojectrecords 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. |
gtryus
approved these changes
Jul 13, 2026
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.
possible race condition: wait for the backup restore to be done before checking projects loaded