Skip to content

enhancement: add retry actions to database mutation error toasts #797

@zacharias-ona

Description

@zacharias-ona

Description

All 15 database mutation error toasts across use-database-rows, use-database-properties, and use-database-views show a plain text message like "Failed to update cell" with no actionable recovery option. When a transient network error causes a mutation to fail, the user must manually redo the operation. Adding a "Retry" action button to these toasts (using sonner's action option) would let users recover from transient failures with one click.

This is motivated by the high volume of transient network error bugs fixed recently (24 Sentry-noise bugs in the past week). While the error classification is now correct, the user-facing recovery path is still friction-heavy.

Acceptance Criteria

  • Error toasts in use-database-rows.ts (add row, move card, update cell, save option, delete row) include a "Retry" action that re-invokes the failed operation
  • Error toasts in use-database-properties.ts (add column, rename property, reorder columns, delete column) include a "Retry" action
  • Error toasts in use-database-views.ts (create view, update config, rename view, delete view, duplicate view, reorder views) include a "Retry" action
  • Retry action captures the original arguments in a closure — no stale state
  • Unit tests verify that the retry callback is passed to toast.error for at least one operation per hook
  • pnpm lint && pnpm typecheck && pnpm test pass

Dependencies

None

Technical Notes

  • Sonner's toast.error accepts an action option: toast.error("Failed to X", { action: { label: "Retry", onClick: () => retryFn() }, duration: 8000 })
  • The existing undo toasts in use-database-rows.ts and use-database-properties.ts already use the action pattern — follow the same approach
  • Each mutation callback already has all arguments in scope, so wrapping the retry in a closure is straightforward
  • For handleCellUpdate, the rollback already restores previous state — retry should use the original (not rolled-back) values
  • Reference src/components/database/hooks/use-database-rows.ts, use-database-properties.ts, use-database-views.ts

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions