Improve pricing tier input handling and precision
Refactored PricingTiers component to better handle empty, null, and undefined values, prevent formatting issues, and add error handling for tier changes. Updated ProductModal to use parseFloat for price values to improve precision. Minor robustness improvements to event handling and sorting.
This commit is contained in:
@@ -142,7 +142,7 @@ export const ProductModal: React.FC<ProductModalProps> = ({
|
||||
...prev,
|
||||
pricing: prev.pricing.map((tier, i) =>
|
||||
i === index
|
||||
? { ...tier, [name]: value === "" ? 0 : Number(value) }
|
||||
? { ...tier, [name]: value === "" ? 0 : parseFloat(value) || 0 }
|
||||
: tier
|
||||
),
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user