SALEOR-1888-1889 - Fix voucher and sales sorting errors (#1063)
* Fix voucher and sales sorting errors * Update changelog * Fix channel slug argument in sorting
This commit is contained in:
parent
e5df1b2dbf
commit
bddfa2c4af
4 changed files with 7 additions and 5 deletions
|
@ -34,6 +34,7 @@ All notable, unreleased changes to this project will be documented in this file.
|
||||||
- Handle limit reached error - #990 by @dominik-zeglen
|
- Handle limit reached error - #990 by @dominik-zeglen
|
||||||
- Display Cloud limits - #1004 by @dominik-zeglen
|
- Display Cloud limits - #1004 by @dominik-zeglen
|
||||||
- Add shipping method description - #1058 by @jwm0
|
- Add shipping method description - #1058 by @jwm0
|
||||||
|
- Fix voucher and sales sorting errors - #1063 by @orzechdev
|
||||||
|
|
||||||
# 2.11.1
|
# 2.11.1
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ export const SaleList: React.FC<SaleListProps> = ({ params }) => {
|
||||||
() => ({
|
() => ({
|
||||||
...paginationState,
|
...paginationState,
|
||||||
filter: getFilterVariables(params),
|
filter: getFilterVariables(params),
|
||||||
sort: getSortQueryVariables(params)
|
sort: getSortQueryVariables(params, channel?.slug)
|
||||||
}),
|
}),
|
||||||
[params]
|
[params]
|
||||||
);
|
);
|
||||||
|
|
|
@ -76,7 +76,7 @@ export const VoucherList: React.FC<VoucherListProps> = ({ params }) => {
|
||||||
() => ({
|
() => ({
|
||||||
...paginationState,
|
...paginationState,
|
||||||
filter: getFilterVariables(params),
|
filter: getFilterVariables(params),
|
||||||
sort: getSortQueryVariables(params)
|
sort: getSortQueryVariables(params, channel?.slug)
|
||||||
}),
|
}),
|
||||||
[params]
|
[params]
|
||||||
);
|
);
|
||||||
|
|
|
@ -72,7 +72,7 @@ type GetSortQueryField<TUrlField extends string, TSortField extends string> = (
|
||||||
type GetSortQueryVariables<
|
type GetSortQueryVariables<
|
||||||
TSortField extends string,
|
TSortField extends string,
|
||||||
TParams extends Record<any, any>
|
TParams extends Record<any, any>
|
||||||
> = (params: TParams) => SortingInput<TSortField>;
|
> = (params: TParams, channelSlug?: string) => SortingInput<TSortField>;
|
||||||
export function createGetSortQueryVariables<
|
export function createGetSortQueryVariables<
|
||||||
TUrlField extends string,
|
TUrlField extends string,
|
||||||
TSortField extends string,
|
TSortField extends string,
|
||||||
|
@ -80,13 +80,14 @@ export function createGetSortQueryVariables<
|
||||||
>(
|
>(
|
||||||
getSortQueryField: GetSortQueryField<TUrlField, TSortField>
|
getSortQueryField: GetSortQueryField<TUrlField, TSortField>
|
||||||
): GetSortQueryVariables<TSortField, TParams> {
|
): GetSortQueryVariables<TSortField, TParams> {
|
||||||
return (params: TParams) => {
|
return (params: TParams, channelSlug?: string) => {
|
||||||
const field = getSortQueryField(params.sort);
|
const field = getSortQueryField(params.sort);
|
||||||
|
|
||||||
if (!!field) {
|
if (!!field) {
|
||||||
return {
|
return {
|
||||||
direction: getOrderDirection(params.asc),
|
direction: getOrderDirection(params.asc),
|
||||||
field
|
field,
|
||||||
|
channel: channelSlug
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue