fix: Report failed GitHub PR and issue actions - #521
Conversation
There was a problem hiding this comment.
mutate is the fire-and-forget form, so it now catches the error instead of letting it escape as an unhandled rejection.
- The error still reaches
error,isErrorandonError, so no error UI changes. mutateAsyncstill throws, so callers thatawaitit keep their try/catch behavior.
Generated by Claude Code
There was a problem hiding this comment.
useGhErrorToast lives here because both detail panes need it.
- It uses a toast rather than inline text, which matches the existing
openOrCreateWorkspaceerror path inPrDetail. String(error)covers Tauriinvokerejections, which arrive as plain strings rather thanErrorobjects.
Generated by Claude Code
|
The Generated by Claude Code |
Comment, close, reopen and draft/ready actions in the GitHub panel's PR and issue detail panes had no error handling, so a gh failure just reset the button with no message. They now raise an error toast carrying the gh message. useMutation.mutate() also re-threw into a void promise, so every failed fire-and-forget mutation surfaced as an unhandled rejection. The error already reaches onError and the error state, so mutate() now swallows it.
3c35ac6 to
eb4d4f6
Compare
handleMarkFileViewed hashed whatever hunks were in allFileHunks at click time. While a diff is loading that entry is a placeholder with empty hunks, so marking a file Viewed early stored the hash of the placeholder. Once the real hunks arrived, the stale-content effect saw a mismatch and silently un-marked the file. This is also the root cause of the flaky reviews "mark a file as viewed" integration test. Only hash loaded hunks; an empty hash is never treated as stale. (cherry picked from commit 6ef2cf8)
"hides the message queue when the agentMessageQueue preview is off" only set the in-memory feature preview store. Rendering the Dashboard hydrates settings, and hydrateFlags rebuilds every flag from defaults (all on in test mode) plus persisted settings, so whenever hydration resolved after the setState the flag flipped back on and the queue button rendered. Persist the setting through setSetting, as feature-preview.test.tsx does, and restore it when the test finishes. (cherry picked from commit 88ab81c)
37df85c to
8968e61
Compare
|
Update after rebasing onto
I copied both fixes into this branch (8670207, 8968e61). They become no-ops once those PRs merge. Generated by Claude Code |
|
None of these components go through Generated by Claude Code |
Problem
onErrorhandler. When gh failed (auth, permissions, network), the button reset and the user saw no message.useMutation.mutate()calledvoid mutateAsync(...), andmutateAsyncre-throws. Every failed fire-and-forget mutation in the app therefore became an unhandled promise rejection.Fix
github-panel/shared.tsx: add auseGhErrorToast()helper that returns anonErrorwhich shows an error toast containing the gh message.PrDetail.tsxandIssueDetail.tsx: every action now has a titled error toast, for example "Failed to close pull request" or "Failed to post comment". When a comment fails to post, the typed comment stays in the box.useMutation.ts:mutate()now catches the rejection. The error still reacheserror,isErrorandonError, andmutateAsyncstill throws for callers that await it.Tests
test/integration/github-panel-detail.test.tsx): failing Close PR, failing PR comment (the draft is kept) and failing Close Issue. All three failed, with unhandled rejections, before the fix and pass after it.github-action-error-toast.spec.tsx: capture checked against its expectations.npm run test:unit,lint,checkandformatare clean.Generated by Claude Code