Set UPC validation loading state to only show on item number field
This commit is contained in:
@@ -279,8 +279,8 @@ const ItemNumberCell = React.memo(({
|
||||
</div>
|
||||
)}
|
||||
{isValidating ? (
|
||||
<div className="flex items-center justify-center gap-2">
|
||||
<Loader2 className="h-4 w-4 animate-spin text-blue-500" />
|
||||
<div className={`flex items-center justify-center gap-2 border ${hasError || isRequiredButEmpty ? 'border-red-500' : 'border-input'} rounded-md h-10`}>
|
||||
<Loader2 className="h-4 w-4 animate-spin text-foreground ml-2" />
|
||||
<span>{displayValue || ''}</span>
|
||||
</div>
|
||||
) : (
|
||||
@@ -395,7 +395,7 @@ const ValidationCell = ({
|
||||
</div>
|
||||
)}
|
||||
{isValidating ? (
|
||||
<div className="flex items-center justify-center gap-2">
|
||||
<div className={`flex items-center justify-center gap-2 border ${hasError || isRequiredButEmpty ? 'border-red-500' : 'border-input'} rounded-sm px-2 py-1.5`}>
|
||||
<Loader2 className="h-4 w-4 animate-spin text-blue-500" />
|
||||
<span>Loading...</span>
|
||||
</div>
|
||||
|
||||
@@ -852,12 +852,11 @@ const ValidationContainer = <T extends string>({
|
||||
|
||||
// Memoize the enhanced validation table component
|
||||
const EnhancedValidationTable = useMemo(() => React.memo((props: React.ComponentProps<typeof ValidationTable>) => {
|
||||
// Create validatingCells set from validatingUpcRows, but only for UPC and item_number fields
|
||||
// This ensures supplier fields don't disappear during UPC validation
|
||||
// Create validatingCells set from validatingUpcRows, but only for item_number fields
|
||||
// This ensures only the item_number column shows loading state during UPC validation
|
||||
const validatingCells = new Set<string>();
|
||||
validatingUpcRows.forEach(rowIndex => {
|
||||
// Only mark the UPC and item_number cells as validating, NOT the supplier
|
||||
validatingCells.add(`${rowIndex}-upc`);
|
||||
// Only mark the item_number cells as validating, NOT the UPC or supplier
|
||||
validatingCells.add(`${rowIndex}-item_number`);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user