feat: clear Sessions search after opening a session

Merged
GR
5mo ago
+271-7

What

The Sessions tab kept the search keyword across hide/show. Once you opened a session and switched to its terminal, returning to CodeV still showed the stale keyword — so you had to press Esc to clear it before starting a new search.

(The Projects tab already clears automatically because react-select resets its input on blur; the plain Sessions <input> had no such logic.)

Behavior

FlowResult
Type a keyword → hide via shortcut / Esc / blur (no item selected) → reopenKeyword kept (resume searching)
Type a keyword → open a session (Enter or click) → reopenKeyword cleared, full list shown

This matches the intuition that selecting a session means "done with this search", while merely toggling away means "I'll come back to it".

How

A clearSessionSearchOnShowRef flag is set when a session is opened (Enter or item click). On the next onFocusWindow (window re-show) the flag triggers a search reset before refetching, so:

  • the list never flashes to unfiltered during the (sometimes slow, AppleScript-driven) terminal switch — it stays on your filtered results until the window actually hides, then comes back clean;
  • toggling away without selecting leaves the flag false → the keyword persists.

+13 lines, all in src/switcher-ui.tsx.

Also included

Two pre-existing yarn lint blockers fixed so the config actually loads and runs:

  • .eslintrc.json trailing comma — was malformed JSON, unparseable by ESLint 8.x.
  • Missing eslint-plugin-react — config extends plugin:react/recommended but the plugin was never a dependency, so ESLint crashed on load. Added it + plugin:react/jsx-runtime (for the automatic JSX transform) + react version detect.

ℹ️ yarn lint now runs, but reports ~5.8k pre-existing issues (5277 prettier/prettier formatting — all --fix-able — plus scattered no-explicit-any/TS warnings). This is long-standing debt, not introduced by this PR and not gating CI (neither test_ci.yaml nor notarize.yml runs lint). Left for a separate yarn lint --fix cleanup.

Test plan

  • Sessions: search → open a session → reopen CodeV → search is cleared
  • Sessions: search → hide via ⌃⌘R (no selection) → reopen → keyword kept
  • Projects tab behavior unchanged
  • tsc --noEmit clean for switcher-ui.tsx

🤖 On behalf of @grimmerk — generated with Claude Code

https://claude.ai/code/session_01BpMcedt11bxQNrcruhL9pF


Summary by cubic

Clears the Sessions search after opening a session so returning shows the full list; toggling away without selecting keeps your keyword. Also fixes ESLint config, adds eslint-plugin-react so yarn lint runs, and bumps to 1.0.75.

  • New Features

    • Clears the Sessions keyword only after opening a session (Enter/click); keeps it when you hide/blur without selecting.
    • On return, the reset runs before refetch and the visible list restores to all sessions to avoid flicker; Projects tab unchanged.
  • Bug Fixes

    • Fixed malformed .eslintrc.json, added plugin:react/jsx-runtime and React version detect, and added eslint-plugin-react so the config loads.
    • Bumped app version to 1.0.75 and updated CHANGELOG.md.

Summary by CodeRabbit

  • Bug Fixes
    • Updated the sessions view so opening a session via Enter or click clears the session search and restores the full list; dismissing/canceling (e.g., Esc/shortcut/blur) now keeps the keyword for continued searching.
    • Cleaned up lint configuration formatting and React lint detection settings to ensure valid, consistent lint behavior.