cachePredictor

cart · /react·function

Build a line predictor that looks merchandise up via a host-supplied KV getter (e.g., a product cache keyed by variant id). The returned partial merchandise is merged onto a minimal placeholder so the cache only needs to provide the fields it actually knows.

Signature

@nordcom/commerce-cart
function cachePredictor(opts: { get: (variantId: string) => Partial<CartLineMerchandise> }): LinePredictor;

Parameters

NameTypeDescription
opts{ get: (variantId: string) => Partial<CartLineMerchandise> }

Returns

A that yields Partial<CartLine> on cache hit and null on miss or for non-add-line mutations.

CartDevtools CartFormProps CartProviderProps AppCartConfig BaseCartActions BuyerIdentityActions CartActions CartAttributeActions

Metadata@nordcom/commerce-cart@0.2.2Open in GitHub ↗

On this page