Skip to content

Commit

Permalink
Fix transaction merge not updating live value
Browse files Browse the repository at this point in the history
  • Loading branch information
ystxn committed Aug 11, 2024
1 parent 60f9f46 commit 72891a6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/transactions/context-menu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const ContextMenu = ({
const handleMergeTransaction = () => {
setContextMenuPosition(null);
const tx = Array.from(apiRef.current.getSelectedRows().values());

const mainTx = (mode === 'import') ? tx[0] : { ...tx[0] };
for (let i=1; i<tx.length; i++) {
const subTx = tx[i];
Expand All @@ -38,7 +39,7 @@ const ContextMenu = ({
listTransactions(mainTx.accountId, (allTx) => {
for (const row of apiRef.current.getRowModels().values()) {
const newRow = allTx.find(({ id }) => id === row.id);
if (row.balance !== newRow.balance) {
if (row.amount !== newRow.amount || row.balance !== newRow.balance) {
apiRef.current.updateRows([ newRow ]);
}
}
Expand Down

0 comments on commit 72891a6

Please sign in to comment.