Skip to content

Make the editor tab and Run agree on which server a query goes to #788

Closed

Description

@EVWorth

Severity: P1 (misleads the user about which server a statement runs on)

What happens

  1. Open ?mock=connected ("Local dev" connected, one "Untitled Query" tab).
  2. Click + ("Connect to a server") and choose "Production (read-only)".
  3. The existing "Untitled Query" tab is silently moved to Production: it now shows a red production dot and a red underline.
  4. Click the "Local dev" connection tab. The editor tab still shows the red Production markers, while the query toolbar and status bar say "Local dev — 127.0.0.1:3306 · DEV".
  5. Type SELECT DATABASE(); and press Ctrl+Enter. It runs on Local dev.

The tab's colour and production dot say one server, while Run uses another. In the reverse case, a tab that looks like dev can run against prod.

Cause

  • src/components/layout/ConnectionTabs.tsx:164-168: handleConnectProfile calls setTabConnection on the active editor tab, which re-targets it to the new connection.
  • Execution uses the global selectedConnectionId, not the tab's connectionId: src/components/editor/SQLEditor.tsx:168 and :204, src/hooks/useQueryExecution.ts:25-39.
  • The editor tab's colour and production dot come from tab.connectionId: src/components/editor/EditorTabs.tsx:186-191.

Fix

Use a single source of truth. Either run against tab.connectionId and have selecting a connection tab switch to (or open) one of its editor tabs, or derive the editor tab's markers from the connection that will actually run the query. Connecting a new server should open a new editor tab, not re-point the current one.

Part of #783.

Activity

  1. added
    bug
    on Oct 21, 2026
  2. added 3 commits that reference this issue on Oct 23, 2026
    4251291
    c1cd372
    3e56feb
  3. added a commit that references this issue on Oct 23, 2026
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions