Skip to content

[P1/bug] handleClick overwrites dirty tab content silently — no isDirty check #341

Closed

Description

@EVWorth

Context

QueryFavorites.tsx:69-77 (handleClick only checks 'query' === activeTab.type, not isDirty).

Problem

handleClick doesn't check that the active tab is type === "query" AND isDirty: false — if the user has a dirty query tab open and clicks a favorite, the favorite's SQL overwrites the dirty content silently. handleDoubleClick (line 79-83) ALWAYS creates a new tab — even if the active tab is a query tab that could receive the SQL. The dual behavior is inconsistent in its check: handleClick has the type check, handleDoubleClick doesn't.

Files

  • src/components/favorites/QueryFavorites.tsx:69-77

Expected

Clicking a favorite while the active query tab is dirty shows a confirmation; choosing Cancel keeps the favorite in the sidebar and the active tab content untouched; choosing Replace loads the favorite.

Proposed fix

Scope S — in handleClick, if the active tab is a query tab with isDirty: true, show a confirmation: "Replace content of current tab? Unsaved changes will be lost." Use the existing editorStore.confirmDiscard if it exists, or just inline window.confirm.

Acceptance

Clicking a favorite while the active query tab is dirty shows a confirmation; choosing Cancel keeps the favorite in the sidebar and the active tab content untouched; choosing Replace loads the favorite.

Needs human verify

no

Activity

  1. added
    audit
    severity/p1
    kind/bug
    area/favorites
    on Jul 31, 2026
  2. added a commit that references this issue on Aug 1, 2026
    c5bd448
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

    area/favoritesauditkind/bugseverity/p1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions