Skip to content

Keep results and run state per editor tab #842

Closed

Description

@EVWorth

Severity: P1 (misleads; feeds the wrong-target save in the grid).

What happens

On http://localhost:1420/?mock=connected:

  1. In tab 1 run UPDATE customers SET city = 'X' WHERE id = 1. Open a new query tab with + and run SELECT * FROM orders.
  2. Switch back to tab 1. Its editor still shows the UPDATE, but the results pane shows tab 2's orders grid with Edit Mode available.
  3. In tab 1 run SELECT SLEEP(5), then open a new empty tab. The empty tab shows "Executing query..." and a red Cancel button for tab 1's query.
  4. In that new tab press Ctrl+Enter on SELECT * FROM customers while tab 1 is still sleeping. Tab 2's result appears, and tab 1's SLEEP result is silently dropped: it is never shown and never recorded in history.
  5. Connect to "Production (read-only)" via + in the connection tab bar. The grid still shows the Local dev customers rows, with Edit Mode offered.

Cause

  • src/stores/resultStore.ts:88-92 holds results, isExecuting, error, page and resultSource as single global values. clearResults is never called outside tests.
  • doExecuteQuery bumps the module-level cancelGeneration (src/stores/resultStore.ts:418), so a run started in one tab makes the other tab's in-flight response be ignored (if (cancelGeneration !== myGeneration) return;).

Fix

Key result state by editor tab id (Record<tabId, TabResultState>, with a cancel generation per tab). ResultsGrid, QueryToolbar, StatusBar and MainPanel should read the active tab's slice. A tab with no run yet should show the empty state.

Part of #783.

Activity

  1. added
    bug
    on Oct 21, 2026
  2. 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