createCartReader
Builds an RSC-safe reader that resolves the active cart for the current
request. The reader is wrapped in react.cache so that multiple Server
Components rendering in one request share a single adapter call.
When the stored id no longer resolves on the provider — either null from
the adapter or a thrown — the reader clears the
storage so the next request creates a fresh cart instead of resurrecting a
dangling id.
Signature
function createCartReader(opts: { kernel: CartKernel<TExt, TShop>; storage: CartIdStorage }): (ctx: AdapterCtx<TShop>) => Promise<Cart<TExt>>;Parameters
| Name | Type | Description |
|---|---|---|
opts | { kernel: CartKernel<TExt, TShop>; storage: CartIdStorage } |
Returns
Async reader returning the resolved or null.
Related
AuthBridge CartIdStorage CreateTypedCartActionsOpts FormCartActions HttpOnlyCookieStorageOpts NextEventBridge TypedCartActions NextEventBridgeHandlers
createCartEnsurer
Builds an "ensure a cart exists" helper for server actions and RSC entry points that need a nonnull cart to operate on. Delegates to the supplied reader for the
createFormCartActions
Wraps a surface in zeroJS FormData adapters. Each wrapper parses the form, mints a serverside idempotency key, and forwards the typed call — so the same action