From 51dba9f43b07817c837b48d6157c8d60c525b40c Mon Sep 17 00:00:00 2001 From: Dawid Tarasiuk Date: Mon, 12 Jul 2021 10:02:47 +0200 Subject: [PATCH] Disable next step when no value selected in variant selector (#1218) * Disable next step when no value selected in variant selector * Update changelog * Update test snapshots --- CHANGELOG.md | 1 + .../ProductVariantCreatorPage/ProductVariantCreatorPage.tsx | 5 ++--- src/storybook/__snapshots__/Stories.test.ts.snap | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24b17feab..6b630aec3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,6 +61,7 @@ All notable, unreleased changes to this project will be documented in this file. - Fix forbidden null sending as attribute value - #1201 by @orzechdev - Fix huge payload issue for plugins view - #1203 by @kamilpastuszka - Fix missing call for update metadata mutation - #1207 by @orzechdev +- Disable next step when no value selected in variant selector - #1218 by @orzechdev - Fix order links on home page - #1219 by @jwm0 - Fix huge payload issue for plugins view - #1203 by @kamilpastuszka diff --git a/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorPage.tsx b/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorPage.tsx index 4af4c8a81..8ab7bf27c 100644 --- a/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorPage.tsx +++ b/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorPage.tsx @@ -55,9 +55,8 @@ function canHitNext( switch (step) { case ProductVariantCreatorStep.values: return ( - (data.attributes.every(attribute => attribute.values.length > 0) && - variantsLeft === null) || - getVariantsNumber(data) <= variantsLeft + data.attributes.every(attribute => attribute.values.length > 0) && + (variantsLeft === null || getVariantsNumber(data) <= variantsLeft) ); case ProductVariantCreatorStep.prices: if (data.price.mode === "all") { diff --git a/src/storybook/__snapshots__/Stories.test.ts.snap b/src/storybook/__snapshots__/Stories.test.ts.snap index 4799df2a9..ca49e5e63 100644 --- a/src/storybook/__snapshots__/Stories.test.ts.snap +++ b/src/storybook/__snapshots__/Stories.test.ts.snap @@ -180147,9 +180147,10 @@ exports[`Storyshots Views / Products / Create multiple variants interactive 1`] class="PageHeader-root-id" >