Skip to content

Commit

Permalink
Merge pull request #150 from 0101oak/oak/fix-measurements-popup
Browse files Browse the repository at this point in the history
fix table pop up after size change
  • Loading branch information
ijustseeblood authored Oct 23, 2024
2 parents 9de8273 + c31723a commit c4ec31f
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const SizesAndMeasurements: FC<ProductSizesAndMeasurementsInterface> = ({
const { values, setFieldValue, errors, touched } = useFormikContext<common_ProductNew>();
const [lastSizeNonZero, setLastSizeNonZero] = useState(false);
const [hasChangedSize, setHasChangedSize] = useState<{ [key: number]: boolean }>({});
const [hasConfirmedSizeChange, setHasConfirmedSizeChange] = useState(false);
const sortedSizes = dictionary && dictionary.sizes ? sortItems(dictionary.sizes) : [];
const sortedMeasurements =
dictionary && dictionary.measurements ? sortItems(dictionary.measurements) : [];
Expand Down Expand Up @@ -82,12 +83,13 @@ export const SizesAndMeasurements: FC<ProductSizesAndMeasurementsInterface> = ({
) => {
const { value } = event.target;

if (isEditMode && sizeId && !hasChangedSize[sizeId]) {
if (isEditMode && sizeId && !hasChangedSize[sizeId] && !hasConfirmedSizeChange) {
const confirmed = window.confirm('Are you sure you want to change the size quantity?');
if (!confirmed) {
return;
}
setHasChangedSize((prev) => ({ ...prev, [sizeId]: true }));
setHasConfirmedSizeChange(true);
}

const sizeIndex = values.sizeMeasurements?.findIndex(
Expand Down

0 comments on commit c4ec31f

Please sign in to comment.