Skip to content

Comments

Fix stale QuickClip suggestion after clipboard item deletion#1877

Open
liketheduck wants to merge 2 commits intofuto-org:masterfrom
liketheduck:fix/1766-clipboard-cache-invalidation
Open

Fix stale QuickClip suggestion after clipboard item deletion#1877
liketheduck wants to merge 2 commits intofuto-org:masterfrom
liketheduck:fix/1766-clipboard-cache-invalidation

Conversation

@liketheduck
Copy link

Summary

Fixes a bug where deleted clipboard items continued to appear as QuickClip suggestions in the action bar. The QuickClip cache was not invalidated when items were removed from clipboard history, causing stale entries to persist until the 60-second cache TTL expired.

Closes #1766.

Changes

  • QuickClip.kt: Added invalidateCache() method that clears the cached previous item and state.
  • ClipboardHistoryAction.kt: Calls invalidateCache() after manual item removal (onRemove) and after background pruning (pruneOldItems). Also calls markQuickClipDismissed() on manual removal to prevent immediate re-suggestion.

Test plan

  • Copy text to clipboard, verify QuickClip suggestion appears
  • Delete the item from clipboard history, verify QuickClip suggestion disappears immediately
  • Verify pruned items (old or over-limit) no longer appear as QuickClip suggestions
  • Verify normal QuickClip behavior is unaffected for non-deleted items

Co-authored with Claude Code.

When users delete clipboard items from clipboard history, the QuickClip
cache could still hold references to the deleted items, causing them to
appear as suggestions in the action bar. This fix invalidates the cached
state in QuickClip when items are explicitly removed via onRemove() and
when items are pruned by pruneOldItems(), ensuring deleted clipboard
content no longer surfaces as QuickClip suggestions.

Fixes futo-org#1766

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The previous commit cleared the QuickClip singleton cache but not the
Compose MutableState in UixManager that drives the actual UI. This
caused the stale suggestion pill to reappear when closing the clipboard
panel back to the main keyboard view within the same input session.

Exposes dismissQuickClips() through KeyboardManagerForAction and calls
it from both the single-item delete and bulk clear-unpinned paths.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA-signed Clipboard Enhancement Request for a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Clipboard doesn't actually delete copied text

3 participants