Add support for persistent storage of panel layouts, sizes, and active tabs#4017
Add support for persistent storage of panel layouts, sizes, and active tabs#4017
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements workspace layout persistence, enabling the editor to save and restore panel arrangements and sizes across sessions. It adds new message types and handlers across the desktop backend, WASM wrapper, and frontend, including support for a "Reset Workspace" action and a "Focus Document" mode. Review feedback suggests ensuring the persistence directory is created before writing files, refactoring duplicate tree traversal logic into a helper method, and validating input lengths when updating panel group sizes to ensure consistency.
There was a problem hiding this comment.
1 issue found across 16 files
Confidence score: 3/5
- There is a concrete data-integrity risk in
frontend/src/utility-functions/persistence.ts: convertingBigInttoNumbercan silently lose precision and corrupt persisted workspace layout values when they exceedNumber.MAX_SAFE_INTEGER. - I’m scoring this as moderate merge risk because the issue is user-impacting (corrupted persisted data) and has medium-high confidence, even though it appears localized to one persistence path.
- Pay close attention to
frontend/src/utility-functions/persistence.ts- ensure BigInt values are stored in a lossless format (for example, strings) before merging.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="frontend/src/utility-functions/persistence.ts">
<violation number="1" location="frontend/src/utility-functions/persistence.ts:179">
P2: Converting BigInt to Number here can silently lose precision for large IDs/sizes. That will corrupt workspace layout data when values exceed Number.MAX_SAFE_INTEGER. Preserve BigInt as a string (or another lossless representation) instead of Number().</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
There was a problem hiding this comment.
1 issue found across 6 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="desktop/src/workspace_layout.rs">
<violation number="1" location="desktop/src/workspace_layout.rs:13">
P2: Changing the persisted layout filename without a read fallback or migration drops previously saved workspace layouts for existing users.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="frontend/src/components/window/PanelSubdivision.svelte">
<violation number="1" location="frontend/src/components/window/PanelSubdivision.svelte:253">
P2: This `:has(.panel.document-panel)` selector is too broad in the recursive layout and will match ancestor subdivisions too. Limit it to direct containment so only the intended subdivision gets the hole-punch overlay.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
6cb2a6f to
2962fe7
Compare
There was a problem hiding this comment.
1 issue found across 12 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="frontend/src/components/window/PanelSubdivision.svelte">
<violation number="1" location="frontend/src/components/window/PanelSubdivision.svelte:15">
P2: `subdivision` is now optional, but the pointer-up callback still uses `"Split" in subdivision` without a null check, which can throw at runtime if the prop changes during a drag.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Closes #195