fix(desktop): load designs on app startup so persisted work reappears#99
Merged
fix(desktop): load designs on app startup so persisted work reappears#99
Conversation
Contributor
There was a problem hiding this comment.
Findings
- No high-confidence issues found in added/modified lines.
Summary
- Review mode: initial
- No issues found in the latest diff.
- Residual risks/testing gaps:
docs/VISION.mdanddocs/PRINCIPLES.mdare Not found in repo/docs in this checkout, so principle-level conformance could not be fully verified from local files; added coverage validatesloadDesigns()state population but does not include an integration-level assertion for App startup bootstrap ordering (loadConfig+loadDesigns+ auto-switchDesign).
Testing
- Not run (automation)
open-codesign Bot
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.
Symptom
Users reported "退出再进来 design 都没了" — generated designs were correctly persisted to SQLite (
design_snapshotsrows confirmed present), but on relaunch the hub appeared empty.Root cause
apps/desktop/src/renderer/src/App.tsxonly invokedloadConfig()in the startupuseEffect. The store already hadloadDesigns()(which callswindow.codesign.snapshots.listDesigns()and populatesdesigns), but nothing in the renderer ever called it on mount. So the in-memory list stayed empty even though the DB had rows.Fix
loadConfigandloadDesignsin parallel.currentDesignIdis null and at least one persisted design exists, auto-switchDesignto the most recent one (first item —listDesignsis already sorted by activity), so users land back on their last work.store.test.tsthat stubslistDesignsto return 2 rows and verifiesstate.designs.length === 2plusdesignsLoaded === true.This completes the persistence flow opened by #93.
Four checks
loadDesigns/switchDesignactions.App.tsx.Test plan
pnpm test— 293 passed (was 292; +1 new case).pnpm lint— passes (existing warnings only).