Skip to content

fix(desktop): use Alerter for automation detail delete confirm#3695

Merged
saddlepaddle merged 2 commits into
mainfrom
satya/super-436-schedule-automation-delete-button-uses-native-menu-instead
Apr 24, 2026
Merged

fix(desktop): use Alerter for automation detail delete confirm#3695
saddlepaddle merged 2 commits into
mainfrom
satya/super-436-schedule-automation-delete-button-uses-native-menu-instead

Conversation

@saddlepaddle
Copy link
Copy Markdown
Collaborator

@saddlepaddle saddlepaddle commented Apr 24, 2026

Summary

  • Replaces the native window.confirm() on the automation detail page with the shared alert() helper from @superset/ui/atoms/Alert, matching the rest of the app's delete-confirm UX.

Closes SUPER-436.

Test plan

  • Open an automation detail page, click Delete, confirm the shadcn dialog appears (not a native browser dialog)
  • Cancel dismisses without deleting; Delete removes the automation and navigates back to /automations

Summary by cubic

Replaces native window.confirm() on the automation detail page with the shared alert() from @superset/ui/atoms/Alert so delete confirmations use the app’s shadcn dialog on desktop. Wraps deleteMutation.mutateAsync() in toast.promise from @superset/ui/sonner to show loading, success, and error states; closes SUPER-436.

Written for commit f7f6388. Summary will update on new commits.

Summary by CodeRabbit

  • New Features
    • Replaced browser confirm prompt with an in-app alert dialog for automation deletion, offering "Cancel" and destructive "Delete" actions.
    • Added user feedback during deletion with loading, success, and error toasts to improve clarity and responsiveness.

Closes SUPER-436. Replaces native window.confirm() on the automation
detail page with the shared alert() helper so the confirm matches the
rest of the app's UI.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d77956f6-b5bb-438d-ba2e-9d347e4a5e34

📥 Commits

Reviewing files that changed from the base of the PR and between 11b19d8 and f7f6388.

📒 Files selected for processing (1)
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/$automationId/page.tsx

📝 Walkthrough

Walkthrough

The deletion confirmation on the automation detail page was changed from a synchronous browser confirm() to an asynchronous UI alert dialog; the delete action now awaits deleteMutation.mutateAsync() wrapped in toast.promise() and preserves existing onSuccess navigation behavior.

Changes

Cohort / File(s) Summary
Confirmation Dialog Refactor
apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/$automationId/page.tsx
Replaced synchronous confirm() prompt with an async alert dialog offering "Cancel" and a destructive "Delete" action. On "Delete", calls deleteMutation.mutateAsync() inside toast.promise() to show loading/success/error states; previous direct deleteMutation.mutate() branch removed. Existing onSuccess navigation retained.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I nibble keys and hum a tune,
Replacing pops at afternoon,
A gentle dialog, clear and bright,
Async delete — swift as flight,
Hooray for smoother clicks tonight!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: replacing native confirm() with a shadcn Alert dialog for automation deletion.
Description check ✅ Passed The description provides a clear summary, links the related issue (SUPER-436), and includes a test plan with specific verification steps.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch satya/super-436-schedule-automation-delete-button-uses-native-menu-instead

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 and usage tips.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 24, 2026

Greptile Summary

This PR replaces the native window.confirm() dialog on the automation detail page with the shared alert() helper from @superset/ui/atoms/Alert, bringing the delete-confirm UX in line with the rest of the app. The implementation correctly switches to mutateAsync() so the Alerter can track loading state and keep the dialog open on failure.

Confidence Score: 5/5

Safe to merge — a focused, correct swap of native confirm() for the shared Alerter dialog with no logic regressions.

The only finding is a P2 UX suggestion about silent error feedback on delete failure, which is a pre-existing limitation of the shared Alerter component rather than a defect introduced by this PR.

No files require special attention.

Important Files Changed

Filename Overview
apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/$automationId/page.tsx Replaces native window.confirm() with the shared Alerter dialog; uses mutateAsync() so the dialog tracks loading state and remains open on failure. No logic or correctness issues introduced.

Sequence Diagram

sequenceDiagram
    participant User
    participant AutomationDetailHeader
    participant Alerter
    participant deleteMutation
    participant Router

    User->>AutomationDetailHeader: Click Delete
    AutomationDetailHeader->>Alerter: alert({ title, description, actions })
    Alerter-->>User: Show shadcn Dialog

    alt User clicks Cancel
        User->>Alerter: onClick() no-op
        Alerter-->>User: Close dialog
    else User clicks Delete
        User->>Alerter: onClick() mutateAsync()
        Alerter->>deleteMutation: mutateAsync()
        Note over Alerter: loadingIndex set, spinner shown

        alt Delete succeeds
            deleteMutation-->>Alerter: resolves
            deleteMutation->>Router: onSuccess navigate /automations
            Alerter-->>User: setIsOpen(false)
        else Delete fails
            deleteMutation-->>Alerter: throws error
            Alerter->>Alerter: console.error no user feedback
            Alerter-->>User: Dialog stays open, buttons re-enabled
        end
    end
Loading
Prompt To Fix All With AI
This is a comment left during a code review.
Path: apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/$automationId/page.tsx
Line: 92-94

Comment:
**Silent failure on delete error**

If `deleteMutation.mutateAsync()` rejects, `Alerter.handleAction` catches the error and logs it to the console, but the dialog simply re-enables its buttons with no user-visible feedback. The user won't know the deletion failed — they'll just see the spinner stop with the dialog still open. Consider passing an `onError` option to the mutation (or surfacing a toast/message) so failures don't disappear silently.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix(desktop): use Alerter for automation..." | Re-trigger Greptile

Comment on lines +92 to +94
onClick: async () => {
await deleteMutation.mutateAsync();
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Silent failure on delete error

If deleteMutation.mutateAsync() rejects, Alerter.handleAction catches the error and logs it to the console, but the dialog simply re-enables its buttons with no user-visible feedback. The user won't know the deletion failed — they'll just see the spinner stop with the dialog still open. Consider passing an onError option to the mutation (or surfacing a toast/message) so failures don't disappear silently.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/$automationId/page.tsx
Line: 92-94

Comment:
**Silent failure on delete error**

If `deleteMutation.mutateAsync()` rejects, `Alerter.handleAction` catches the error and logs it to the console, but the dialog simply re-enables its buttons with no user-visible feedback. The user won't know the deletion failed — they'll just see the spinner stop with the dialog still open. Consider passing an `onError` option to the mutation (or surfacing a toast/message) so failures don't disappear silently.

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/$automationId/page.tsx (1)

83-98: LGTM — async flow is correct.

The switch to alert() correctly leverages the Alerter's async action handling: mutateAsync() is awaited so the dialog stays open (and the Delete button shows its loading state) until the mutation resolves, and navigation continues to occur via deleteMutation.onSuccess. Since Alerter.handleAction already catches and logs rejected onClick promises (see packages/ui/src/atoms/Alert/Alert.tsx lines 44-54), the await here won't produce an unhandled rejection on delete failure.

One small cleanup: AlertAction.onClick is optional (onClick?: () => void | Promise<void>), so the Cancel action's onClick: () => {} can be dropped.

♻️ Optional simplification
 							actions: [
-								{ label: "Cancel", variant: "outline", onClick: () => {} },
+								{ label: "Cancel", variant: "outline" },
 								{
 									label: "Delete",
 									variant: "destructive",
 									onClick: async () => {
 										await deleteMutation.mutateAsync();
 									},
 								},
 							],
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/`$automationId/page.tsx
around lines 83 - 98, The Cancel action in the alert payload is providing an
empty noop handler even though AlertAction.onClick is optional; remove the
unnecessary onClick: () => {} from the Cancel action inside the onDelete handler
so the actions array only includes the Cancel action object with label and
variant and the Delete action that calls await deleteMutation.mutateAsync();
this simplifies the alert payload in the onDelete closure that calls alert(...)
and avoids an unused noop function.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/`$automationId/page.tsx:
- Around line 83-98: The Cancel action in the alert payload is providing an
empty noop handler even though AlertAction.onClick is optional; remove the
unnecessary onClick: () => {} from the Cancel action inside the onDelete handler
so the actions array only includes the Cancel action object with label and
variant and the Delete action that calls await deleteMutation.mutateAsync();
this simplifies the alert payload in the onDelete closure that calls alert(...)
and avoids an unused noop function.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6a11c6b7-b523-4992-877a-27c77221808f

📥 Commits

Reviewing files that changed from the base of the PR and between aceb0fd and 11b19d8.

📒 Files selected for processing (1)
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/$automationId/page.tsx

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 1 file

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/$automationId/page.tsx">

<violation number="1" location="apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/$automationId/page.tsx:93">
P2: Wrap the `deleteMutation.mutateAsync()` call in a try/catch (or supply an `onError` callback) and surface a toast or inline message on failure. Currently, if the delete request rejects, the dialog re-enables its buttons with no user-visible feedback, silently swallowing the error.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Addresses review feedback on #3695: the Alerter would silently swallow
a failed delete. Wrap mutateAsync in toast.promise so the user sees
loading, success, and error states.
@saddlepaddle saddlepaddle merged commit 8ce1519 into main Apr 24, 2026
7 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ⚠️ Neon database branch

Thank you for your contribution! 🎉

@Kitenite Kitenite deleted the satya/super-436-schedule-automation-delete-button-uses-native-menu-instead branch May 6, 2026 04:52
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