Skip to content

Commit 043b827

Browse files
committed
use object with stable ref and add comment about source values
1 parent c06ee2d commit 043b827

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/libs/actions/OnyxDerived/configs/reportTransactionsAndViolations.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type {OnyxCollection} from 'react-native-onyx';
22
import createOnyxDerivedValueConfig from '@userActions/OnyxDerived/createOnyxDerivedValueConfig';
3+
import CONST from '@src/CONST';
34
import ONYXKEYS from '@src/ONYXKEYS';
45
import type {Transaction} from '@src/types/onyx';
56

@@ -10,9 +11,11 @@ export default createOnyxDerivedValueConfig({
1011
dependencies: [ONYXKEYS.COLLECTION.TRANSACTION, ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS],
1112
compute: ([transactions, violations], {sourceValues, currentValue}) => {
1213
if (!transactions) {
13-
return {};
14+
return CONST.EMPTY_OBJECT;
1415
}
1516

17+
// If there is a source value for transactions or transaction violations, we need to process only the transactions that have been updated or added
18+
// If not, we need to process all transactions
1619
const transactionsUpdates = sourceValues?.[ONYXKEYS.COLLECTION.TRANSACTION];
1720
const transactionViolationsUpdates = sourceValues?.[ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS];
1821
let transactionsToProcess = Object.keys(transactions);

0 commit comments

Comments
 (0)