Skip to content

fix: cancel in-flight work when hiding the overlay#72

Closed
quiet-node wants to merge 2 commits intomainfrom
worktree-idempotent-tinkering-codd
Closed

fix: cancel in-flight work when hiding the overlay#72
quiet-node wants to merge 2 commits intomainfrom
worktree-idempotent-tinkering-codd

Conversation

@quiet-node
Copy link
Copy Markdown
Owner

Summary

  • Calling cancel() and clearing pending submit/message state in requestHideOverlay so that hiding the overlay (via double-tap Control, Escape, Cmd+W, or X button) stops any active Ollama streaming, image processing, or screen capture
  • Previously these operations continued running in the background after hide, which could cause stale responses to appear on next activation

Test plan

  • All 463 frontend tests pass
  • 100% code coverage maintained
  • validate-build passes (lint + format + typecheck + build)

🤖 Generated with Claude Code

quiet-node and others added 2 commits April 9, 2026 23:27
Hiding the overlay (double-tap Control, Escape, Cmd+W, or X button) now
cancels any active Ollama streaming, image processing, or screen capture.
Previously these operations continued running in the background after hide,
which could cause stale responses to appear on next activation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>
The cancel() call in requestHideOverlay is fire-and-forget (async, not
awaited). When the user quickly reopens the overlay, replayEntranceAnimation
calls reset() which clears all messages. But the old channel's onmessage
callback still holds references to the same React state setters. When the
Cancelled chunk (or late tokens) arrive, they re-populate the cleared state,
causing the previous session's text to reappear.

Fix: add an epoch counter to useOllama, mirroring the backend's epoch
pattern in ConversationHistory. Each reset() bumps the epoch. The channel
callback snapshots the epoch at generation start and bails out if a reset
has occurred since then.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>
@quiet-node quiet-node closed this Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant