Skip to content

Commit

Permalink
feat(headless commerce): add totalCount to InstantProducts controller…
Browse files Browse the repository at this point in the history
… state (#4321)

https://coveord.atlassian.net/browse/KIT-3491

Co-authored-by: Louis Bompart <lbompart@coveo.com>
  • Loading branch information
fbeaudoincoveo and louis-bompart authored Aug 27, 2024
1 parent 3f957f9 commit d6570ac
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ export interface InstantProductsState {
* An error returned when executing an instant products request, if any. This is `null` otherwise.
*/
error: CommerceAPIErrorResponse | SerializedError | null;
/**
* The total number of products that match the current query.
*/
totalCount: number;
}

/**
Expand Down Expand Up @@ -220,6 +224,7 @@ export function buildInstantProducts(
isLoading: cached?.isLoading || false,
error: cached?.error || null,
products: getProducts(),
totalCount: cached?.totalCountFiltered || 0,
};
},
};
Expand Down

0 comments on commit d6570ac

Please sign in to comment.