Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ final class MainWindow {
initialContent: msg.initialContent
)
show()
windowState.togglePanel(.documentEditor)
windowState.selection = .panel(.documentEditor)
}

func handleDocumentEditorUpdate(_ msg: DocumentEditorUpdateMessage) {
Expand All @@ -189,7 +189,7 @@ final class MainWindow {
initialContent: content
)
show()
windowState.togglePanel(.documentEditor)
windowState.selection = .panel(.documentEditor)
}

func show() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1171,7 +1171,7 @@ struct MainWindowView: View {
DocumentEditorPanelView(
documentManager: documentManager,
daemonClient: daemonClient,
onClose: { windowState.selection = nil }
onClose: { windowState.selection = nil; documentManager.closeDocument() }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve unsaved edits when dismissing document panel

Calling documentManager.closeDocument() inside the panel close handler turns a UI dismiss action into a hard document reset, which clears currentContent/initialContent and cancels pending saves in DocumentManager.closeDocument(). In the common flow where a user types in the editor but has not clicked Save yet, closing and reopening the panel now drops those local edits and reloads only daemon-backed content, causing silent data loss that did not happen when close only hid the panel.

Useful? React with 👍 / 👎.

)
}
)
Expand Down