diff --git a/.changeset/eight-baths-win.md b/.changeset/eight-baths-win.md new file mode 100644 index 0000000000..9fe3d44628 --- /dev/null +++ b/.changeset/eight-baths-win.md @@ -0,0 +1,5 @@ +--- +"@medusajs/dashboard": patch +--- + +fix(dashboard): form reset for across allocation diff --git a/packages/admin/dashboard/src/routes/promotions/promotion-create/components/create-promotion-form/create-promotion-form.tsx b/packages/admin/dashboard/src/routes/promotions/promotion-create/components/create-promotion-form/create-promotion-form.tsx index d823263943..eebf5f33bf 100644 --- a/packages/admin/dashboard/src/routes/promotions/promotion-create/components/create-promotion-form/create-promotion-form.tsx +++ b/packages/admin/dashboard/src/routes/promotions/promotion-create/components/create-promotion-form/create-promotion-form.tsx @@ -275,6 +275,12 @@ export const CreatePromotionForm = () => { } } + // if switching to `across` allocation, reset call above will set the max quantity to 1 which is forbidden for this allocation type + // but since there wasn't change in the `application_method.allocation` field, useEffect below responsible for resetting will not be triggered + if (currentTemplate.defaults?.application_method?.allocation === "across") { + setValue("application_method.max_quantity", null) + } + return currentTemplate }, [watchTemplateId, setValue, reset])