Skip to content

Commit ba1af3b

Browse files
authoredNov 9, 2023
Merge pull request #29939 from tienifr/fix/28941
fix: 28941 LHN - Money Request removal offline does not update LHN correctly
2 parents 30505fe + 432f3eb commit ba1af3b

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed
 

‎src/libs/ReportActionsUtils.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import _ from 'lodash';
22
import lodashFindLast from 'lodash/findLast';
33
import Onyx, {OnyxCollection, OnyxEntry, OnyxUpdate} from 'react-native-onyx';
4+
import OnyxUtils from 'react-native-onyx/lib/utils';
45
import {ValueOf} from 'type-fest';
56
import CONST from '@src/CONST';
67
import ONYXKEYS from '@src/ONYXKEYS';
@@ -378,13 +379,7 @@ function replaceBaseURL(reportAction: ReportAction): ReportAction {
378379
/**
379380
*/
380381
function getLastVisibleAction(reportID: string, actionsToMerge: ReportActions = {}): OnyxEntry<ReportAction> {
381-
let reportActions: ReportActions;
382-
if (actionsToMerge && Object.keys(actionsToMerge).length !== 0) {
383-
reportActions = {...allReportActions?.[reportID]};
384-
Object.keys(actionsToMerge).forEach((actionToMergeID) => (reportActions[actionToMergeID] = {...allReportActions?.[reportID]?.[actionToMergeID], ...actionsToMerge[actionToMergeID]}));
385-
} else {
386-
reportActions = allReportActions?.[reportID] ?? {};
387-
}
382+
const reportActions = Object.values(OnyxUtils.fastMerge(allReportActions?.[reportID] ?? {}, actionsToMerge));
388383
const visibleReportActions = Object.values(reportActions ?? {}).filter((action) => shouldReportActionBeVisibleAsLastAction(action));
389384
const sortedReportActions = getSortedReportActions(visibleReportActions, true);
390385
if (sortedReportActions.length === 0) {

0 commit comments

Comments
 (0)
Please sign in to comment.