Skip to content

Commit

Permalink
feat(headless commerce ssr): merge controller props and ControllerDef…
Browse files Browse the repository at this point in the history
…initionOption (#4316)

### Proposition

having all options in a single argument

![image](https://github.com/user-attachments/assets/e2177d7c-08f8-44e9-938e-f346e9affd0d)

just to stay consistent with all controllers (one argument per define
function)

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

---------

Co-authored-by: Alex Prudhomme <[email protected]>
Co-authored-by: Frederic Beaudoin <[email protected]>
Co-authored-by: Louis Bompart <[email protected]>
  • Loading branch information
4 people authored Sep 6, 2024
1 parent aa0802c commit 951b1c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ export type {Pagination, PaginationProps, PaginationState};
*/
export function definePagination<
TOptions extends ControllerDefinitionOption | undefined,
>(props?: PaginationProps, options?: TOptions) {
ensureAtLeastOneSolutionType(options);
>(props?: PaginationProps & TOptions) {
ensureAtLeastOneSolutionType(props);
return {
...options,
...props,
build: (engine, solutionType) =>
solutionType === SolutionType.listing
? buildProductListing(engine).pagination(props)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ export type {Sort, SortProps, SortState};
*/
export function defineSort<
TOptions extends ControllerDefinitionOption | undefined,
>(props?: SortProps, options?: TOptions) {
ensureAtLeastOneSolutionType(options);
>(props?: SortProps & TOptions) {
ensureAtLeastOneSolutionType(props);
return {
...options,
...props,
build: (engine, solutionType) =>
solutionType === SolutionType.listing
? buildProductListing(engine).sort(props)
Expand Down

0 comments on commit 951b1c7

Please sign in to comment.