CartActionResult
Discriminated result returned by a server action.
On success, ok: true carries the updated cart. On failure, ok: false
carries a code, a human message, and
optional field-scoped userErrors for display.
Definition
type CartActionResult = { cart: Cart<TExt>; ok: true } | { cart: Cart<TExt>; message: string; ok: false; reason: CartActionFailureReason; userErrors: { field: string; message: string }[] };{ cart: Cart<TExt>; ok: true } | { cart: Cart<TExt>; message: string; ok: false; reason: CartActionFailureReason; userErrors: { field: string; message: string }[] }
Example
const result = await submitMutation(envelope);
if (result.ok) updateCart(result.cart);
else showError(result.reason, result.message);Related
RunCartAdapterContractOpts runCartAdapterContract CartCapabilityUnsupportedError CartError CartNotFoundError CartProviderError CartUserError CartAdapter
CartActionFailureReason
Machinereadable failure code surfaced on the reason field of a failing . UI layers switch on this to decide whether to show a retry button, a validation message
CartAdapter
Contract that every cart provider implementation satisfies. Adapters expose required CRUD operations and declare their optional capabilities so the kernel can g