Skip to content

Detached windows discard unsaved query changes without asking #473

Description

@erikdarlingdata

#462 gave query tabs an unsaved-changes prompt on tab close and window close. Detached windows dodge both.

Detach to Window on a dirty query tab moves the session into a free-floating window via DetachedWindowHelper.ShowDetached. Closing that window destroys the content with no prompt — the close path is the helper's own, and it never asks anyone anything. The tab is also out of MainTabControl.Items while detached, so TabsWithUnsavedChanges() can't see it either: the main window's shutdown prompt walks the tab strip and honestly reports nothing to save while your edit sits dirty in another window.

The helper already takes an onClosing callback, and UnsavedChangesDialog.ShowAsync takes any Window as owner, so the pieces exist — nothing is wired.

Scope worth being explicit about:

  • Closing the detached window directly must prompt Save / Don't Save / Cancel, with Cancel keeping the window open. Same rules as Warn about unsaved query changes, and mark modified tabs #462: save-in-place when the session has a file, Save As when it doesn't.
  • App shutdown closes every detached window from MainWindow.OnClosed — after the main window is already gone, which is a bad moment to raise a dialog. At minimum that path must not hang or crash; whether it can reasonably prompt is a design question for the implementation to answer and defend.
  • Plan and Query Store content also detach through this helper and are read-only; they must keep closing silently.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions