diff --git a/src/components/pages/production/transfer-to-laying/TransferToLayingConfirmationModal.tsx b/src/components/pages/production/transfer-to-laying/TransferToLayingConfirmationModal.tsx index 2975a865..555c1667 100644 --- a/src/components/pages/production/transfer-to-laying/TransferToLayingConfirmationModal.tsx +++ b/src/components/pages/production/transfer-to-laying/TransferToLayingConfirmationModal.tsx @@ -50,12 +50,18 @@ const TransferToLayingConfirmationModalTable = ({ transferToLayingForm?: TransferToLayingFormValues; transferToLayingId?: number; }) => { + const isValidId = + transferToLayingId !== undefined && + transferToLayingId !== null && + !isNaN(transferToLayingId) && + transferToLayingId > 0; + const { data: transferToLaying, isLoading: isLoadingTransferToLaying } = useSWR( - transferToLayingId + isValidId ? ['detail-transfer-to-laying', String(transferToLayingId)] : undefined, - ([id]) => TransferToLayingApi.getSingle(Number(id)) + ([, id]) => TransferToLayingApi.getSingle(Number(id)) ); const confirmationTableColumns: ColumnDef[] = @@ -273,12 +279,16 @@ const TransferToLayingConfirmationModal = ({ {transferToLayingIds && !transferToLayingForm && - transferToLayingIds.map((transferToLayingId, idx) => ( - - ))} + transferToLayingIds + .filter( + (id) => id !== undefined && id !== null && !isNaN(id) && id > 0 + ) + .map((transferToLayingId, idx) => ( + + ))} {withNote && (