Fix ref issue

This commit is contained in:
Oliver Walters 2026-06-29 13:59:14 +00:00
parent 2831ac41d3
commit 2b065d6340
3 changed files with 9 additions and 7 deletions

View File

@ -230,6 +230,7 @@ function TableFieldComponent({
};
}
valueRef.current = nextValue;
onChangeRef.current(nextValue);
},
[resolveRowIndex]

View File

@ -648,6 +648,7 @@ function BuildAllocateLineRow({
<Table.Td>
<NumberInput
radius='sm'
aria-label='number-field-quantity'
min={0}
step={1}
decimalScale={10}
@ -701,6 +702,7 @@ export function useAllocateStockToBuildForm({
const buildLines = useMemo(() => {
return lineItems.map((item) => {
return {
id: item.pk,
...item
};
});

View File

@ -144,14 +144,12 @@ function TransferOrderAllocateLineRow({
q = Math.max(q, required);
q = Math.min(q, available);
if (q != quantity) {
setQuantity(q);
props.changeFn(props.rowId, 'quantity', q);
}
setQuantity(q);
props.changeFn(props.rowId, 'quantity', q);
}
}
};
}, [sourceLocation, record, quantity]);
}, [sourceLocation, record, quantity, props.changeFn]);
return (
<Table.Tr key={`table-row-${props.rowId}`}>
@ -175,6 +173,7 @@ function TransferOrderAllocateLineRow({
<Table.Td>
<NumberInput
radius='sm'
aria-label='number-field-quantity'
min={0}
step={1}
decimalScale={10}
@ -189,7 +188,7 @@ function TransferOrderAllocateLineRow({
nextValue = Number.isFinite(parsed) ? parsed : '';
}
setQuantity(nextValue);
setQuantity(nextValue === '' ? 0 : nextValue);
props.changeFn(props.rowId, 'quantity', nextValue);
}}
error={props.rowErrors?.quantity?.message}
@ -245,7 +244,7 @@ export function useAllocateToTransferOrderForm({
},
items: {
field_type: 'table',
value: lineItems,
value: [],
headers: [
{ title: t`Part`, style: { minWidth: '200px' } },
{ title: t`Allocated`, style: { minWidth: '200px' } },