Skip to content

Stop debounced entry resets surfacing "Cancelled" error toast#2415

Open
myieye wants to merge 3 commits into
developfrom
claude/vibrant-wilson-37e435
Open

Stop debounced entry resets surfacing "Cancelled" error toast#2415
myieye wants to merge 3 commits into
developfrom
claude/vibrant-wilson-37e435

Conversation

@myieye

@myieye myieye commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Rapid filter typing / entry switching in the viewer could pop a red "Cancelled" error toast. runed's useDebounce rejects pending promises with the string "Cancelled" when cancel() supersedes them; in EntryLoaderService those rejections went unhandled (notably the fire-and-forget void this.#scheduleFilterReset() in the watch), so the global error handler surfaced them.

Fix swallows only the "Cancelled" string rejection at the two debounced call sites (#scheduleFilterReset, #scheduleEventReset), rethrowing anything else so genuine load errors still surface. Scoped to the service rather than the global handler to keep the suppression narrow.

Reproduced on /testing/project-view by typing a filter and immediately clicking an entry. svelte-check clean.

🤖 Generated with Claude Code

runed's useDebounce rejects pending promises with the string "Cancelled"
when cancel() supersedes them. In EntryLoaderService these rejections went
unhandled (notably the fire-and-forget reset in the watch), so the global
error handler surfaced a red "Cancelled" toast during rapid filter typing
or entry switching. Swallow only that specific rejection at the debounced
call sites, rethrowing anything else so real errors still surface.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions github-actions Bot added the 💻 FW Lite issues related to the fw lite application, not miniLcm or crdt related label Jul 6, 2026
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 0649c68f-97cd-4a4f-abc3-0411db6474b5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

A helper function ignoreDebounceCancelled was added to entry-loader-service.svelte.ts to intercept and suppress promise rejections with reason "Cancelled", while rethrowing other errors. It is applied via .catch(...) in both #scheduleFilterReset() and #scheduleEventReset().

Changes

Debounce cancellation handling

Layer / File(s) Summary
Cancellation helper and reset wiring
frontend/viewer/src/lib/services/entry-loader-service.svelte.ts
Adds ignoreDebounceCancelled to swallow "Cancelled" rejections and rethrow others, and applies it via .catch(...) to both #scheduleFilterReset and #scheduleEventReset debounced promises.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Poem

A cancelled hop, no need to fret,
The rabbit catches, no regret. 🐇
"Cancelled" whispers pass on by,
Real errors still get flagged, not shy.
Debounce resets now smooth and neat!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: suppressing debounced reset 'Cancelled' errors from showing as toasts.
Description check ✅ Passed The description matches the changeset and explains the root cause, fix, and scope clearly.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/vibrant-wilson-37e435

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@argos-ci

argos-ci Bot commented Jul 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ✅ No changes detected - Jul 6, 2026, 1:27 PM

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
frontend/viewer/src/lib/services/entry-loader-service.svelte.ts (1)

30-37: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider a test for the rethrow branch.

The existing test around debounce collapsing (entry-loader-service.svelte.test.ts:184-204) confirms the suppression path works but doesn't assert that a non-"Cancelled" rejection from the debounced reset still propagates as an error. Worth adding given this is the crux of the fix (only suppress the specific cancellation, not genuine failures).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/viewer/src/lib/services/entry-loader-service.svelte.ts` around lines
30 - 37, Add a test in entry-loader-service.svelte.test.ts for the rethrow path
of ignoreDebounceCancelled: verify that when the debounced reset rejects with
something other than "Cancelled", the error is not swallowed and still
propagates. Extend the existing debounce collapsing coverage around the entry
loader service/reset flow so it asserts the suppression only applies to the
specific cancellation case, while genuine failures from useDebounce remain
observable.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@frontend/viewer/src/lib/services/entry-loader-service.svelte.ts`:
- Around line 30-37: Add a test in entry-loader-service.svelte.test.ts for the
rethrow path of ignoreDebounceCancelled: verify that when the debounced reset
rejects with something other than "Cancelled", the error is not swallowed and
still propagates. Extend the existing debounce collapsing coverage around the
entry loader service/reset flow so it asserts the suppression only applies to
the specific cancellation case, while genuine failures from useDebounce remain
observable.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 5e3ac1cd-d027-4bb6-989d-8877c25dcfcf

📥 Commits

Reviewing files that changed from the base of the PR and between 915ca19 and b99fdff.

📒 Files selected for processing (1)
  • frontend/viewer/src/lib/services/entry-loader-service.svelte.ts

Export the helper and assert "Cancelled" is swallowed while any other
rejection still propagates, per CodeRabbit review on #2415. The service-level
reset path cannot exercise the rethrow branch since #executeReset swallows its
own fetch errors, so this covers the helper directly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@myieye

myieye commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed the nitpick: exported ignoreDebounceCancelled and added tests asserting "Cancelled" is swallowed while any other rejection rethrows (40858cd). The service-level reset path cannot exercise the rethrow branch because #executeReset swallows its own fetch errors into service.error, so the helper is tested directly.

🤖 Addressed by Claude Code

The .catch(ignoreDebounceCancelled) wrapper makes quietReset() return a fresh
promise per call, so the old expect(p1).toBe(p2) identity checks no longer hold.
Collapse behavior is unchanged and already covered by the single-API-call
assertion; assert that directly instead of promise identity.

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

Labels

💻 FW Lite issues related to the fw lite application, not miniLcm or crdt related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant