COP-46 - Tools launch bug#131
Merged
Merged
Conversation
This reverts commit bf01a61.
📊 Coverage Report
|
🧪 E2E Test Results✅ 18 passed, 0 failed, 0 skipped
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: tools launcher hotkey scans live clipboard, not stale stored clip (COP-46)
Summary
The "open tools launcher for latest clip" hotkey scanned the most recently
stored clip from history instead of what is actually on the system clipboard
right now. When the user copied something and immediately fired the hotkey (window
unfocused), the launcher showed results for the previous clip.
This fixes it by having the main process read the live clipboard directly and pass
that content to the launcher.
Root cause
HotkeyActions.openToolsLauncher()readstorage.getClips()[0].clip.content.clips[0]is the most recent clip in stored history, which trails the realclipboard: history only updates through an async pipeline (250ms main-process poll
->
clipboard-changedIPC -> renderer dedup/add -> save-back via IPC). Firing thehotkey inside that window meant
storage.getClips()[0]was still the previous clip,so the launcher scanned stale content.
The launcher renderer (
ToolsLauncher.tsx->QuickClipsScanner) only consumes acontent: stringand has no dependency on history, so passing the live clipboardcontent directly fully fixes the scan.
Approach (Option A)
Read the live clipboard in the main process and pass it straight to the launcher --
no forced history update, no new IPC handshake, no renderer roundtrip.
openToolsLauncher()now callsgetCurrentClipboardData()(already exposed) forthe current
{ type, content }and passes thatcontenttocreateToolsLauncherWindow().storage.getClips()[0].clip.contentonly when the live read returnsnull/empty (e.g. empty clipboard or an unsupported format).
Rejected alternative (Option B): drive the renderer to ingest the live clipboard and
wait for the save before opening. Rejected because add-to-history logic (dedup,
locking, language detection, max-clips, echo guards, storage save) is owned by the
renderer; driving it from the hotkey handler requires a new request/response IPC
handshake, gates the launcher open on an async roundtrip, and is sensitive to
hidden-window
backgroundThrottling.Changes
src/main/hotkeys/actions.ts--openToolsLauncher()reads live clipboard viagetCurrentClipboardData(), falls back to the most recent stored clip when thelive read is empty.
src/main/hotkeys/actions.test.ts-- new unit coverage (see below).Housekeeping (incidental)
CLAUDE.mdand ignoregraphify-out/in.gitignore.Testing
stored history when live has content; fallback to stored clip when the live read
is null; fallback when live content is empty; no-op when live read is null and no
history; no-op when first stored clip is null; error handled gracefully.
npm run lintandnpm run typecheck-- zero errors/warnings.npx vitest run --coverage-- 411 tests pass, 100% statements/branches/functions/lines.npx playwright test-- 18/18 e2e pass.Acceptance criteria
just-copied text, not the previous clip.
openToolsLauncher()sources content from the live clipboard(
getCurrentClipboardData()), notstorage.getClips()[0].empty launcher when history has content).
storage.getClips()[0]is stale.