Merge pull request #456 from mirumee/fix/draft-add-product-reset

Reset state after closing
This commit is contained in:
Dominik Żegleń 2020-04-06 11:19:35 +02:00 committed by GitHub
commit 74ba8e1cc4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View file

@ -39,6 +39,7 @@ All notable, unreleased changes to this project will be documented in this file.
- Handle rich text editor content error - #395 by @dominik-zeglen
- Fix crashing views - #422 by @dominik-zeglen
- Add "Ready to capture" to the "Status" order filter - #430 by @dominik-zeglen
- Reset state after closing - #456 by @dominik-zeglen
## 2.0.0

View file

@ -29,6 +29,7 @@ import { OrderErrorFragment } from "@saleor/orders/types/OrderErrorFragment";
import getOrderErrorMessage from "@saleor/utils/errors/order";
import useModalDialogErrors from "@saleor/hooks/useModalDialogErrors";
import FormSpacer from "@saleor/components/FormSpacer";
import useModalDialogOpen from "@saleor/hooks/useModalDialogOpen";
import {
SearchOrderVariant_search_edges_node,
SearchOrderVariant_search_edges_node_variants
@ -180,6 +181,10 @@ const OrderProductAddDialog: React.FC<OrderProductAddDialogProps> = props => {
>([]);
const errors = useModalDialogErrors(apiErrors, open);
useModalDialogOpen(open, {
onClose: () => setVariants([])
});
const selectedVariantsToProductsMap = products
? products.map(product =>
product.variants.map(variant => isVariantSelected(variant, variants))