Skip to content

Commit bd042c8

Browse files
committed
Add explanatory comment for visualOrderTransactionIDsKey
Made-with: Cursor
1 parent d0897bc commit bd042c8

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,11 @@ function MoneyRequestReportTransactionList({
280280
return groupedTransactions.flatMap((group) => group.transactions.filter((transaction) => !isTransactionPendingDelete(transaction)).map((transaction) => transaction.transactionID));
281281
}, [groupedTransactions, sortedTransactions, shouldShowGroupedTransactions]);
282282

283+
// Primitive proxy for visualOrderTransactionIDs used as the effect dependency below.
284+
// Other callers (e.g. TransactionDuplicateReview.onPreviewPressed) can write to the same
285+
// Onyx key with a different ordering. Using the raw array reference would cause the effect
286+
// to re-fire on every referential change and overwrite those IDs. The joined string ensures
287+
// the effect only re-fires when the actual content changes.
283288
const visualOrderTransactionIDsKey = useMemo(() => visualOrderTransactionIDs.join(','), [visualOrderTransactionIDs]);
284289

285290
useEffect(() => {

0 commit comments

Comments
 (0)