Skip to content

[P0/bug] Rename input's onBlur commits before the click handler — race condition #333

Closed

Description

@EVWorth

Context

QueryFavorites.tsx:251-265 (rename input onBlur commits, then click on next favorite also commits).

Problem

The rename flow is onBlur={handleRenameConfirm} on the input. When the user clicks a different favorite to navigate, the rename input blurs first → handleRenameConfirm runs → THEN the new favorite's onClick runs. The order is fine for the rename, but the order is fragile: if the user clicks the favorite they've been editing (a one-click "I changed my mind, just close the edit"), the click event fires on the parent

AFTER the blur commits. The current implementation handles this correctly because the click only fires handleClick (load into editor), but if a future change adds a "Delete on click" affordance, the race becomes a real bug. More concerningly: the rename input's onClick={(e) => e.stopPropagation()} (line 256) properly stops propagation, but the outer
(line 209) doesn't have a corresponding handler. If the user clicks anywhere in the row OUTSIDE the input (e.g., the SQL preview line), the blur fires and the click reaches the favorite-load handler. The user thought "I clicked to load" but the rename silently committed first.

Files

  • src/components/favorites/QueryFavorites.tsx:251-265

Expected

Clicking a different favorite while in rename mode does NOT commit the rename if the user pressed Escape; an unintended click after a long pause does not silently overwrite the name.

Proposed fix

Scope M — add a mousedown event listener on the favorite row that ignores clicks while editingId === fav.id, so the rename UI is modal-like. Or commit the rename only on Enter key, not on blur (lose the auto-commit behavior, gain simplicity). The Enter-only pattern is what most apps use today.

Acceptance

Clicking a different favorite while in rename mode does NOT commit the rename if the user pressed Escape; an unintended click after a long pause does not silently overwrite the name.

Needs human verify

yes

Activity

  1. added
    audit
    severity/p0
    kind/bug
    area/favorites
    on Jul 31, 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

    area/favoritesauditkind/bugseverity/p0

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions