From 9751e37a4bee8319e6fd38ee430a2ab6477e7e50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Loipf=C3=BChrer?= Date: Mon, 9 May 2022 00:21:34 +0200 Subject: [PATCH] fix weird transaction positions editing --- .../transactions/purchase/PurchaseItems.tsx | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/web/src/components/transactions/purchase/PurchaseItems.tsx b/web/src/components/transactions/purchase/PurchaseItems.tsx index 9d442ea2..dbcc8831 100644 --- a/web/src/components/transactions/purchase/PurchaseItems.tsx +++ b/web/src/components/transactions/purchase/PurchaseItems.tsx @@ -230,15 +230,17 @@ export default function PurchaseItems({ group, transaction }: PropTypes) { const [positions, setPositions] = useState([]); useEffect(() => { - setPositions(transaction.positions - .map((p) => ({ ...p, is_empty: false })) - .concat([ - { - ...localPositionChanges.empty, - is_empty: true, - }, - ])); - }, [transaction, setPositions, localPositionChanges]) + setPositions( + transaction.positions + .map((p) => ({ ...p, is_empty: false })) + .concat([ + { + ...localPositionChanges.empty, + is_empty: true, + }, + ]) + ); + }, [transaction, setPositions, localPositionChanges]); // find all accounts that take part in the transaction, either via debitor shares or purchase items // TODO: should we add creditor accounts as well? @@ -542,7 +544,7 @@ export default function PurchaseItems({ group, transaction }: PropTypes) { {transaction.is_wip - ? positions.map(position => ( + ? positions.map((position) => ( )) : positions.map( - position => + (position) => !position.is_empty && ( {position.name}