From e730343866cce8ff519718c14c40c59ded8096b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chy=C5=82a?= Date: Mon, 12 Aug 2024 11:35:07 +0200 Subject: [PATCH] Voucher create save button stay active (#5107) * Voucher create save button stay active * Add changeset --- .changeset/silver-spies-obey.md | 5 +++++ src/products/components/ProductVariantCreatePage/form.tsx | 5 +---- 2 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 .changeset/silver-spies-obey.md diff --git a/.changeset/silver-spies-obey.md b/.changeset/silver-spies-obey.md new file mode 100644 index 00000000000..096521d6036 --- /dev/null +++ b/.changeset/silver-spies-obey.md @@ -0,0 +1,5 @@ +--- +"saleor-dashboard": patch +--- + +You can click save button on voucher creation page to trigger validation diff --git a/src/products/components/ProductVariantCreatePage/form.tsx b/src/products/components/ProductVariantCreatePage/form.tsx index bb15133a75a..8d27dd7d16c 100644 --- a/src/products/components/ProductVariantCreatePage/form.tsx +++ b/src/products/components/ProductVariantCreatePage/form.tsx @@ -60,7 +60,6 @@ import { ProductStockFormsetData, ProductStockInput } from "../ProductStocks"; import { concatChannelsBySelection, createChannelsWithPreorderInfo, - validateChannels, } from "../ProductVariantChannels/formOpretations"; export interface ProductVariantCreateFormData extends MetadataFormData { @@ -281,11 +280,9 @@ function useProductVariantCreateForm( useEffect(() => setExitDialogSubmitRef(submit), [submit]); - const invalidChannels = validateChannels(channels?.data); const invalidPreorder = data.isPreorder && data.hasPreorderEndDate && !!form.errors.preorderEndDateTime; - const formDisabled = invalidPreorder || invalidChannels; - const isSaveDisabled = disabled || formDisabled || !data.variantName || !onSubmit; + const isSaveDisabled = disabled || invalidPreorder || !onSubmit; setIsSubmitDisabled(isSaveDisabled);