Skip to main content
All controllers follow the same pattern with reactive state and three ways to subscribe:
  • state — a ReadonlySignal<QueryState<T>> with { data, error, isFetching }
  • execute() — runs the query, returns Result<T, ClientError>
  • subscribe(callback) — reacts to state changes without importing signals
  • dispose() — cleans up subscriptions and aborts pending requests

client.collection() - Browse collections

Browse products in a collection with filters, sort, and pagination.
Options: Execute parameters:

client.blocks() - Product recommendations

Product recommendations powered by Layers blocks. Anchored to a product, collection, or cart.
Options: Execute parameters: DiscountEntitlement:
See Context for all available context fields (cart, geo, customer, marketing, and more). Block recommendations commonly use productsInCart, geo, customer, and custom. Product search with facets. Options persist across calls, so subsequent execute() calls merge with existing options.
Execute parameters: Predictive search with debouncing and local caching. Only full words (trailing space) are cached. Partial input filters cached results client-side.
Options:

client.uploadImage() - Upload image

Upload an image for image-based search.

client.searchByImage() - Search by image

Search products using an uploaded image.
Parameters:

client.searchContent() - Search articles and blog content

Search articles and blog content with pagination. Options persist across calls, so subsequent execute() calls merge with existing options.
Execute parameters: Response:

createProductCard() - Product card controller

Reactive controller for product cards with variant selection and availability logic. All derived values are computed signals that auto-update when inputs change. This is a standalone function, not a client method.
Options (input): Reactive state (all ReadonlySignal): Actions: ProductCardState (passed to subscribe callback):
Types used by the product card:
OptionValue.status is computed from inventory and availability data across all variants that match the current selection.

Abort signals

Controllers support two levels of abort:
Collection and blocks auto-cancel the previous request when a new execute() starts.

Next steps