Skip to content

feat: show error dialog when server actions fail - #57

Merged
jasoncrawford merged 8 commits into
mainfrom
feature/sms-alerting
Feb 24, 2026
Merged

jasoncrawford merged 8 commits into
mainfrom
feature/sms-alerting

Conversation

@jasoncrawford

Copy link
Copy Markdown
Collaborator

Summary

  • Adds an ErrorDialogProvider context with a native <dialog> modal (styled to match SiteFormDialog) and a useErrorDialog() hook
  • All server actions (addSite, editSite, deleteSite, reorderSites, resolveIncident, addContact, deleteContact, sendInvitation, revokeInvitation) now return { error: string } on failure instead of silently swallowing errors
  • Client components (SiteFormDialog, AddContactForm, SiteList) check return values and show the error dialog; only perform success side-effects (close dialog, reset form) when there's no error
  • Adds a reusable ActionForm client wrapper for server-component pages (SettingsPage, IncidentDetailPage) that can't use hooks directly

Closes #56

Test plan

  • Trigger a server action failure (e.g., temporarily revoke RLS permissions or insert a duplicate) and verify the error dialog appears
  • Verify successful actions still work normally (add/edit/delete site, add/remove contact, send/revoke invitation, resolve incident)
  • Verify the error dialog can be dismissed with OK button
  • Verify SiteFormDialog stays open on error (doesn't close prematurely)
  • Verify AddContactForm doesn't reset type selector on error

🤖 Generated with Claude Code

Server actions previously failed silently. Now all actions return
{ error } on failure, surfaced via a native <dialog> modal matching
the existing SiteFormDialog style.

Closes #56

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel

vercel Bot commented Feb 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
site-status Ready Ready Preview, Comment Feb 24, 2026 2:48pm

Request Review

@supabase

supabase Bot commented Feb 24, 2026 •

Copy link
Copy Markdown

Updates to Preview Branch (feature/sms-alerting) ↗︎

Deployments Status Updated
Database ✅ Tue, 24 Feb 2026 14:48:33 UTC
Services ✅ Tue, 24 Feb 2026 14:48:33 UTC
APIs ✅ Tue, 24 Feb 2026 14:48:33 UTC

Tasks are run on every commit but only new migration files are pushed.
Close and reopen this PR if you want to apply changes from existing seed or migration files.

Tasks Status Updated
Configurations ✅ Tue, 24 Feb 2026 14:48:34 UTC
Migrations ✅ Tue, 24 Feb 2026 14:48:34 UTC
Seeding ✅ Tue, 24 Feb 2026 14:48:35 UTC
Edge Functions ✅ Tue, 24 Feb 2026 14:48:35 UTC

View logs for this Workflow Run ↗︎.
Learn more about Supabase for Git ↗︎.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…eturn

Bare `return` on validation failures (missing fields, invalid webhook
URL) caused silent failures with no error dialog. Now all early returns
surface a user-facing message.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The fetch response body was never read, causing the browser to log
"Fetch failed loading" on every Slack notification.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
jasoncrawford and others added 2 commits February 24, 2026 06:17
The mock responses were missing .text(), causing "response.text is not
a function" after we started consuming the Slack webhook response body.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The DB insert succeeds but the Resend call throws (e.g., no API key in
CI). We were returning early with an error, skipping revalidatePath, so
the new invitation never appeared on the page.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jasoncrawford
jasoncrawford merged commit 7dba838 into main Feb 24, 2026
4 checks passed

This branch was successfully deployed

1 active deployment
Preview — 8b705d54 Deployed Feb 24, 2026 by vercel[bot]
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.

Show error dialog when server actions fail

1 participant