feat: add retry actions to database mutation error toasts (#797)#798
feat: add retry actions to database mutation error toasts (#797)#798zacharias-ona merged 1 commit intomainfrom
Conversation
Co-authored-by: Ona <no-reply@ona.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
✅ Post-merge verification passed. E2E test suite (62 tests against
Ad-hoc smoke tests:
Interaction smoke test (feat PR — database hooks):
|
|
✅ UI verification passed — design spec compliance confirmed. Scope: 3 hook files ( Static analysis:
Storybook visual regression: 1 test (all stories) passed — no visual changes detected. Expected, since the changes are in hook logic only. Steps skipped: Live site screenshots and Storybook-vs-live comparison were skipped because no render output changed — the toast action button is rendered entirely by sonner's internal UI. |
Closes #797
What
Adds a "Retry" action button to all 15 database mutation error toasts across
use-database-rows,use-database-properties, anduse-database-views. When a transient network error causes a mutation to fail, users can now recover with one click instead of manually redoing the operation.How
Each error toast now includes a
{ action: { label: "Retry", onClick: ... } }option using sonner's built-in action support. The retry callback captures the original arguments in a closure and re-invokes the full operation (including optimistic updates and rollback).To avoid self-referencing
useCallbackdeclarations (which triggers thereact-hooks/immutabilitylint rule), ahandlersRefpattern is used: a ref holds the latest handler functions, updated viauseEffect, and retry closures call through the ref.Operations with retry actions:
use-database-rows.ts: add row, move card, update cell, save new option, delete rowuse-database-properties.ts: add column, rename property, reorder columns, delete columnuse-database-views.ts: create view, update config, rename view, delete view, duplicate view, reorder viewsTesting
expect.objectContainingso they remain focused on their original concerntoast.errorand re-invokes the operation when clickedpnpm lint && pnpm typecheck && pnpm test— all pass (0 errors, 1661 tests green)