fix(wizard): prevent duplicate register item addition on step transition
All checks were successful
Staging Build / build (push) Successful in 3m4s
All checks were successful
Staging Build / build (push) Successful in 3m4s
This commit is contained in:
@@ -542,7 +542,12 @@ export function OrderWizard({
|
||||
|
||||
const nextStep = () => {
|
||||
if (step === 3 && allCategoriesFilled && productValidationErrors.length === 0) {
|
||||
if (hasActiveSelection) {
|
||||
const isDirtyNewDevice = deviceName.trim() !== '' || licenseNumber.trim() !== '' || Object.values(moduleQuantities).some(q => q > 0)
|
||||
if (editingIdx !== null) {
|
||||
addToBasket()
|
||||
} else if (basketItems.length === 0 && hasActiveSelection) {
|
||||
addToBasket()
|
||||
} else if (isDirtyNewDevice && hasActiveSelection) {
|
||||
addToBasket()
|
||||
}
|
||||
}
|
||||
@@ -738,7 +743,8 @@ export function OrderWizard({
|
||||
setIsSubmitting(true)
|
||||
try {
|
||||
let finalItems = [...basketItems]
|
||||
if (hasActiveSelection && allCategoriesFilled && productValidationErrors.length === 0) {
|
||||
const isDirtyNewDevice = deviceName.trim() !== '' || licenseNumber.trim() !== '' || Object.values(moduleQuantities).some(q => q > 0)
|
||||
if ((editingIdx !== null || basketItems.length === 0 || isDirtyNewDevice) && hasActiveSelection && allCategoriesFilled && productValidationErrors.length === 0) {
|
||||
const normLicense = licenseNumber.trim().toUpperCase()
|
||||
if (normLicense) {
|
||||
const isDuplicateInBasket = basketItems.some(
|
||||
|
||||
Reference in New Issue
Block a user