Skip to content

fix: restore document state cleanup and use direct panel selection on document show#4822

Merged
marinatrajk merged 1 commit into
mainfrom
swarm/task-2
Feb 19, 2026
Merged

fix: restore document state cleanup and use direct panel selection on document show#4822
marinatrajk merged 1 commit into
mainfrom
swarm/task-2

Conversation

@marinatrajk

@marinatrajk marinatrajk commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Addresses review feedback on #4585

  • Fix 1 (MainWindow.swift): Replace windowState.togglePanel(.documentEditor) with windowState.selection = .panel(.documentEditor) in both handleDocumentEditorShow and handleDocumentLoadResponse. Using togglePanel would accidentally close the panel if a second show message arrived while the panel was already open.

  • Fix 2 (MainWindowView.swift): Restore documentManager.closeDocument() in the onClose handler for DocumentEditorPanelView. Without this call, document state (surfaceId, sessionId, currentContent, etc.) was never cleared when the panel was dismissed, leading to stale state on the next document open.

Test plan

  • Open document editor via daemon message
  • Close and reopen: verify content loads correctly with no stale state
  • Send second document_editor_show while panel is open: verify panel stays open with new content
  • Send document_load_response while panel is open: verify panel stays open with new content

🤖 Generated with Claude Code


Open with Devin

…ment on panel dismiss

Address review feedback on PR #4502:
- Replace togglePanel(.documentEditor) with direct selection assignment to avoid
  accidentally closing the panel when a second document_editor_show or
  document_load_response message arrives while the panel is already open
- Call documentManager.closeDocument() when closing the document editor panel to
  reset stale editorCoordinator state, ensuring reopened documents load correctly

Co-Authored-By: Claude <noreply@anthropic.com>
@marinatrajk marinatrajk self-assigned this Feb 19, 2026
@marinatrajk marinatrajk merged commit 2039eb2 into main Feb 19, 2026
2 checks passed
@marinatrajk marinatrajk deleted the swarm/task-2 branch February 19, 2026 01:27

@devin-ai-integration devin-ai-integration Bot 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

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.

2 participants