Skip to content

feat: add retry actions to database mutation error toasts (#797)#798

Merged
zacharias-ona merged 1 commit intomainfrom
feat/797-retry-actions-error-toasts
Apr 25, 2026
Merged

feat: add retry actions to database mutation error toasts (#797)#798
zacharias-ona merged 1 commit intomainfrom
feat/797-retry-actions-error-toasts

Conversation

@zacharias-ona
Copy link
Copy Markdown
Collaborator

Closes #797

What

Adds a "Retry" action button to all 15 database mutation error toasts across use-database-rows, use-database-properties, and use-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 useCallback declarations (which triggers the react-hooks/immutability lint rule), a handlersRef pattern is used: a ref holds the latest handler functions, updated via useEffect, 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 row
  • use-database-properties.ts: add column, rename property, reorder columns, delete column
  • use-database-views.ts: create view, update config, rename view, delete view, duplicate view, reorder views

Testing

  • Updated existing toast assertions to use expect.objectContaining so they remain focused on their original concern
  • Added retry-specific tests (one per hook) that verify the retry callback is passed to toast.error and re-invokes the operation when clicked
  • pnpm lint && pnpm typecheck && pnpm test — all pass (0 errors, 1661 tests green)

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 25, 2026

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

Project Deployment Actions Updated (UTC)
memo Ready Ready Preview, Comment Apr 25, 2026 2:25pm

Request Review

@zacharias-ona zacharias-ona merged commit 7901ba5 into main Apr 25, 2026
6 checks passed
@zacharias-ona zacharias-ona deleted the feat/797-retry-actions-error-toasts branch April 25, 2026 14:32
@zacharias-ona
Copy link
Copy Markdown
Collaborator Author

✅ Post-merge verification passed.

E2E test suite (62 tests against https://memo.software-factory.dev):

  • public-routes.spec.ts — 14 passed (landing page, sign-in/sign-up validation, auth redirects, health API)
  • auth.spec.ts — 8 passed (sign-in, sign-up, sign-out, auth callback, redirect)
  • database-crud.spec.ts — 10 passed (create database, add row, edit cell, delete row/column, undo, rename property)
  • database-views.spec.ts — 10 passed (sort, filter, create/rename/delete/duplicate views, view tab context menu)
  • database-board.spec.ts — 4 passed (board view switch, column grouping, drag card, create row)
  • database-list.spec.ts — 4 passed (list view switch, row display, row click, create row)
  • page-crud.spec.ts — 4 passed (create, navigate, rename, delete page)
  • editor-auto-save.spec.ts — 2 passed (content persistence, save indicator)
  • sidebar-drag.spec.ts — 2 passed (drag handle, reorder)
  • workspace.spec.ts — 3 passed (switcher visible, opens, create dialog)
  • skip-to-content.spec.ts — 1 passed

Ad-hoc smoke tests:

  • ✅ Landing page — loads, has title
  • ✅ Sign-in page — renders email input
  • ✅ Health endpoint — returns OK
  • ✅ Authenticated login flow — redirects to workspace
  • ✅ No console errors (unauthenticated or authenticated)
  • Skipped: /dashboard (not yet built), editor page navigation (no page buttons in test workspace)

Interaction smoke test (feat PR — database hooks):

  • ✅ Authenticated workspace loads without console errors
  • Skipped: No existing database page in test workspace for direct interaction testing (covered by E2E suite above — 28 database tests passed)

@zacharias-ona
Copy link
Copy Markdown
Collaborator Author

✅ UI verification passed — design spec compliance confirmed.

Scope: 3 hook files (use-database-rows.ts, use-database-properties.ts, use-database-views.ts) + 3 test files. No .tsx render files, no pages, no layouts changed.

Static analysis:

  • All 15 error toasts use sonner's built-in action: { label: "Retry", onClick } API — no custom UI or styles added
  • Error toast duration remains 8000ms per design spec
  • Existing "Undo" actions on destructive operations (delete row/column) are preserved separately
  • No arbitrary colors, spacing, or typography — no design token violations

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.

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.

enhancement: add retry actions to database mutation error toasts

1 participant