Skip to content

Commit

Permalink
Merge pull request #29939 from tienifr/fix/28941
Browse files Browse the repository at this point in the history
fix: 28941 LHN - Money Request removal offline does not update LHN correctly
  • Loading branch information
flodnv authored Nov 9, 2023
2 parents 30505fe + 432f3eb commit ba1af3b
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import _ from 'lodash';
import lodashFindLast from 'lodash/findLast';
import Onyx, {OnyxCollection, OnyxEntry, OnyxUpdate} from 'react-native-onyx';
import OnyxUtils from 'react-native-onyx/lib/utils';
import {ValueOf} from 'type-fest';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
Expand Down Expand Up @@ -378,13 +379,7 @@ function replaceBaseURL(reportAction: ReportAction): ReportAction {
/**
*/
function getLastVisibleAction(reportID: string, actionsToMerge: ReportActions = {}): OnyxEntry<ReportAction> {
let reportActions: ReportActions;
if (actionsToMerge && Object.keys(actionsToMerge).length !== 0) {
reportActions = {...allReportActions?.[reportID]};
Object.keys(actionsToMerge).forEach((actionToMergeID) => (reportActions[actionToMergeID] = {...allReportActions?.[reportID]?.[actionToMergeID], ...actionsToMerge[actionToMergeID]}));
} else {
reportActions = allReportActions?.[reportID] ?? {};
}
const reportActions = Object.values(OnyxUtils.fastMerge(allReportActions?.[reportID] ?? {}, actionsToMerge));
const visibleReportActions = Object.values(reportActions ?? {}).filter((action) => shouldReportActionBeVisibleAsLastAction(action));
const sortedReportActions = getSortedReportActions(visibleReportActions, true);
if (sortedReportActions.length === 0) {
Expand Down

0 comments on commit ba1af3b

Please sign in to comment.