Fix additional panel docking and restoration bugs#4089
Conversation
There was a problem hiding this comment.
Code Review
This pull request enhances the workspace panel layout system by improving how panels are restored to their previous positions. It introduces a SavedPanelPosition struct to capture more context, such as sibling groups and slot sizes, which allows for more accurate restoration even when the original panel group has been pruned. Key additions include logic for finding sibling groups and inserting panels adjacent to them. Feedback suggests refining the document panel detection logic to be more robust across subdivisions and optimizing tree traversals in the insertion logic.
There was a problem hiding this comment.
1 issue found across 2 files
Confidence score: 3/5
- There is a concrete regression risk in
editor/src/messages/portfolio/utility_types.rs: switchingsaved_positionsfrom tuple entries toSavedPanelPositionentries can break deserialization of previously persisted workspace layouts. - Because this is a user-facing compatibility path (loading existing saved layouts) and the issue is high severity/high confidence (7/10, 9/10), the merge risk is moderate rather than low.
- Pay close attention to
editor/src/messages/portfolio/utility_types.rs- ensure backward-compatible deserialization for older persisted layout formats.
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="editor/src/messages/portfolio/utility_types.rs">
<violation number="1" location="editor/src/messages/portfolio/utility_types.rs:211">
P1: Changing `saved_positions` from tuple entries to `SavedPanelPosition` entries breaks backward deserialization of previously persisted workspace layouts.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Fixes more bugs from #4015. Partly closes #195.