LinePredictor
A function that optimistically projects a single cart line given a pending
mutation. Called once per add-line mutation by the projection engine; return
a partial line to override the blank placeholder, or null to fall through to
the next predictor in the chain.
Definition
type LinePredictor = (mutation: CartMutation, ctx: PredictorCtx<TExt>) => Partial<CartLine<TExt['line']>> | null;(mutation: CartMutation, ctx: PredictorCtx<TExt>) => Partial<CartLine<TExt['line']>> | null
Example
const predictors = {
line: [snapshotPredictor(), cachePredictor({ get: cache.get })],
};Related
CartDevtools CartFormProps CartProviderProps AppCartConfig BaseCartActions BuyerIdentityActions CartActions CartAttributeActions
KernelSnapshot
Static capabilities snapshot produced by the cart adapter and passed from the server to the client via CartProviderProps.kernelSnapshot. Drives which optional a
NoteActions
Cartnote mutation method added to when CartCapabilities.notes is true. Replaces the entire cart note with a new string; pass an empty string to clear.