Skip to content

Commit 637d1bd

Browse files
MelvinBotEskalifer1
andcommitted
Move resetSplitShares after isSplitBill early-return in editing path
Split-bill edits use setDraftSplitTransaction (SPLIT_TRANSACTION_DRAFT), so resetSplitShares should not write to ONYXKEYS.COLLECTION.TRANSACTION for that path. The confirmation list's AmountField already handles share recalculation for split-bill edits. Co-authored-by: Eskalifer1 <Eskalifer1@users.noreply.github.com>
1 parent 091051f commit 637d1bd

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/pages/iou/request/step/IOURequestStepAmount.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -413,11 +413,6 @@ function IOURequestStepAmount({
413413
return;
414414
}
415415

416-
// Edits to the amount from the splits page should reset the split shares (only when the amount actually changed).
417-
if (transaction?.splitShares) {
418-
resetSplitShares(transaction, newAmount, selectedCurrency, false);
419-
}
420-
421416
// If currency has changed, then we get the default tax rate based on currency, otherwise we use the current tax rate selected in transaction, if we have it.
422417
const transactionTaxCode = getTransactionDetails(currentTransaction)?.taxCode;
423418
const defaultTaxCode = getDefaultTaxCode(policy, currentTransaction, selectedCurrency) ?? '';
@@ -431,6 +426,11 @@ function IOURequestStepAmount({
431426
return;
432427
}
433428

429+
// Reset split shares for non-split-bill edits (split-bill share recalculation is handled by the confirmation list).
430+
if (transaction?.splitShares) {
431+
resetSplitShares(transaction, newAmount, selectedCurrency, false);
432+
}
433+
434434
updateMoneyRequestAmountAndCurrency({
435435
transactionID,
436436
transactionThreadReport: report,

0 commit comments

Comments
 (0)