Merge branch 'master' into fix/changing-sorting-option-should-reset-pagination

This commit is contained in:
Gabriel L Martinez 2020-04-15 07:55:34 -04:00 committed by GitHub
commit 7226a58688
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View file

@ -42,6 +42,7 @@ All notable, unreleased changes to this project will be documented in this file.
- Reset state after closing - #456 by @dominik-zeglen
- Password validation errors are not shown - #471 by @gabmartinez
- Reset pagination when guest change the sorting of the list - #474 by @gabmartinez
- Filter column ids before send it to GridAttributes operation - #476 by @gabmartinez
- Display Is Published column correctly in main Product Listing - #475 by @gabmartinez
## 2.0.0

View file

@ -34,6 +34,10 @@ import createFilterHandlers from "@saleor/utils/handlers/filterHandlers";
import useCategorySearch from "@saleor/searches/useCategorySearch";
import useCollectionSearch from "@saleor/searches/useCollectionSearch";
import useProductTypeSearch from "@saleor/searches/useProductTypeSearch";
import {
getAttributeIdFromColumnValue,
isAttributeColumnValue
} from "@saleor/products/components/ProductListPage/utils";
import ProductListPage from "../../components/ProductListPage";
import {
TypedProductBulkDeleteMutation,
@ -216,9 +220,15 @@ export const ProductList: React.FC<ProductListProps> = ({ params }) => {
}
);
function filterColumnIds(columns: ProductListColumns[]) {
return columns
.filter(isAttributeColumnValue)
.map(getAttributeIdFromColumnValue);
}
return (
<AvailableInGridAttributesQuery
variables={{ first: 6, ids: settings.columns }}
variables={{ first: 6, ids: filterColumnIds(settings.columns) }}
>
{attributes => (
<TypedProductListQuery displayLoader variables={queryVariables}>