Genesis
@stable

showUndoToast

The undo toast for an `undoable` write (core's `onUndoable`): a sonner toast with an Undo button, shown for as long as the undo is offered. Needs a mounted `<Toaster />`.

packages/ui/src/components/data/undo-toast.ts

Import
Subpath export: @marktiderman/genesis-ui/data
import { showUndoToast } from "@marktiderman/genesis-ui/data";
Components
Auto-generated from TypeScript source via react-docgen-typescript.

showUndoToast

The undo toast for an `undoable` write (core's `onUndoable`): a sonner toast with an Undo button, shown for as long as the undo is offered. Needs a mounted `<Toaster />`.

PropTypeDefaultDescription
commit*() => void—Send a `delay` write now.
delayMs*number—How long the undo is offered, in ms (the toast's duration).
kind*enum—
resource*string—
strategy*enum—- `delay`: the write has not been sent. `undo()` discards it; `commit()` sends it now instead of waiting. - `provider`: the write was sent at once, because the provider serves `undo`. `undo()` asks the provider to reverse it; `commit()` does nothing.
undo*() => Promise<boolean>—Take the write back. Resolves true when it was undone (or will never be sent), false when it could not be: already sent under `delay` (the window closed, it was committed, a later write on the same record sent it first, or the page unloaded), already undone, or the provider's undo failed (reported through `onError`). Works after the hook that made the write has unmounted. Safe to call more than once.
idIdentifier—The record's id; absent for a create (it has none until it is sent).

showWriteErrorToast

The default error report for writes that fail after the form has closed.

No declared props.

writeModeOptions

ResourcePage's write-mode options for its `useResource`: the page's `mutationMode` unless `resourceOptions` sets one, the undo toast, and an error toast for a write that fails after it was shown as done.

No declared props.