useActionToast
useActionToast(
descriptor,config):void
Defined in: packages/ui/src/hooks/use-action-toast.ts:42
Automatically shows toast notifications when @cfast/actions results arrive.
Watches all configured actions via their ClientDescriptor and triggers
success or error toasts when their result data changes. Internally uses
useToast and useActions from @cfast/actions/client.
Must be used within both a ToastProvider and an actions context
(i.e., inside app.Provider).
Parameters
Section titled “Parameters”descriptor
Section titled “descriptor”Client-side action descriptor from @cfast/actions, typically
composed.client from a createActions() call.
config
Section titled “config”ActionToastConfig
Map of action names to toast messages. Only actions listed here are watched; others are ignored.
Returns
Section titled “Returns”void
void
Example
Section titled “Example”// In a route component:useActionToast(composed.client, { deletePost: { success: "Post deleted", error: "Failed to delete" }, publishPost: { success: "Post published" },});