You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[P0/bug] Rename input's onBlur commits before the click handler — race condition #333
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.
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.
Activity
refactor(favorites): one inline editor, used twice (#617)