Skip to content

fix: use direct panel selection for document editor to prevent toggle-close#4828

Merged
marinatrajk merged 1 commit into
mainfrom
feedback/4512
Feb 19, 2026
Merged

fix: use direct panel selection for document editor to prevent toggle-close#4828
marinatrajk merged 1 commit into
mainfrom
feedback/4512

Conversation

@marinatrajk

@marinatrajk marinatrajk commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Addresses review feedback on PR #4512 (document preview widget in chat).

The P1 review comment noted that tapping a document preview widget when
the editor panel is already open with a different document could accidentally
close the panel (since togglePanel acts as a toggle). This fix replaces
togglePanel(.documentEditor) with windowState.selection = .panel(.documentEditor)
in both handleDocumentEditorShow and handleDocumentLoadResponse so that opening
the document editor is always an open operation, never a close.

Changes

  • clients/macos/vellum-assistant/Features/MainWindow/MainWindow.swift: Replace
    windowState.togglePanel(.documentEditor) with windowState.selection = .panel(.documentEditor)
    in handleDocumentEditorShow and handleDocumentLoadResponse to prevent accidentally
    closing the panel when a second show message arrives while the panel is already open
    (e.g. when multiple document preview widgets are present in chat).

Context

The P2 fix (persisting document preview surfaces across app restarts) was addressed
in PR #4639 by auto-tracking ui_surface_show messages from tools in
currentTurnSurfaces so they are serialised into the assistant message at
message_complete and survive thread reloads.

Test plan

  • Open a document with document_create
  • Verify the document editor panel opens
  • Click the inline document preview widget again
  • Verify the panel stays open (does not toggle-close)
  • With multiple document previews, click each to verify the correct document loads

🤖 Generated with Claude Code


Open with Devin

…-close

Address review feedback on PR #4512 (#4639 follow-up):
- Replace windowState.togglePanel(.documentEditor) with windowState.selection = .panel(.documentEditor)
  in handleDocumentEditorShow and handleDocumentLoadResponse to avoid accidentally
  closing the editor panel when a second document_editor_show or document_load_response
  message arrives while the panel is already open (e.g. when multiple document preview
  widgets are present in chat and the user clicks one whose document is already loaded)

Co-Authored-By: Claude <noreply@anthropic.com>
@marinatrajk marinatrajk self-assigned this Feb 19, 2026
@marinatrajk marinatrajk merged commit 3ada256 into main Feb 19, 2026
1 check passed
@marinatrajk marinatrajk deleted the feedback/4512 branch February 19, 2026 01:32

@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 1 additional finding.

Open in Devin Review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 467c3706ae

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

)
show()
windowState.togglePanel(.documentEditor)
windowState.selection = .panel(.documentEditor)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Persist document editor as active panel when opening it

Setting windowState.selection directly here (and similarly in handleDocumentLoadResponse) drops the persistence side effect that togglePanel used to provide via lastActivePanelString in MainWindowState.togglePanel. As a result, after opening a document editor from these daemon messages, restoreLastActivePanel() can no longer restore the document editor on reconnect/app restart and may reopen a stale previous panel instead, which is a regression from the prior behavior.

Useful? React with 👍 / 👎.

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