Skip to content

Commit a742756

Browse files
authored
Merge pull request #62151 from Expensify/revert-62002-korytko/fix-empty-report-preview
[CP Staging] Revert "Filter out report previews that shouldn't be shown in ReportPreview & MoneyRequestReportView"
2 parents 89ec9dc + 41108ae commit a742756

File tree

3 files changed

+11
-17
lines changed

3 files changed

+11
-17
lines changed

src/components/MoneyRequestReportView/MoneyRequestReportView.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import getNonEmptyStringOnyxID from '@libs/getNonEmptyStringOnyxID';
1818
import Log from '@libs/Log';
1919
import {selectAllTransactionsForReport, shouldDisplayReportTableView} from '@libs/MoneyRequestReportUtils';
2020
import navigationRef from '@libs/Navigation/navigationRef';
21-
import {getFilteredReportActionsForReportView, getOneTransactionThreadReportID, isMoneyRequestAction} from '@libs/ReportActionsUtils';
21+
import {getOneTransactionThreadReportID, isDeletedParentAction, isMoneyRequestAction} from '@libs/ReportActionsUtils';
2222
import {canEditReportAction, getReportOfflinePendingActionAndErrors, isReportTransactionThread} from '@libs/ReportUtils';
2323
import {buildCannedSearchQuery} from '@libs/SearchQueryUtils';
2424
import Navigation from '@navigation/Navigation';
@@ -95,9 +95,8 @@ function MoneyRequestReportView({report, policy, reportMetadata, shouldDisplayRe
9595
const [isComposerFullSize] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_IS_COMPOSER_FULL_SIZE}${reportID}`, {initialValue: false, canBeMissing: true});
9696
const {reportPendingAction, reportErrors} = getReportOfflinePendingActionAndErrors(report);
9797

98-
const {reportActions: unfilteredReportActions, hasNewerActions, hasOlderActions} = usePaginatedReportActions(reportID);
99-
const reportActions = getFilteredReportActionsForReportView(unfilteredReportActions);
100-
98+
const {reportActions: reportActionsWithDeletedExpenses, hasNewerActions, hasOlderActions} = usePaginatedReportActions(reportID);
99+
const reportActions = reportActionsWithDeletedExpenses.filter((value) => !isDeletedParentAction(value));
101100
const transactionThreadReportID = getOneTransactionThreadReportID(reportID, reportActions ?? [], isOffline);
102101

103102
const [transactions = []] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION, {

src/libs/ReportActionsUtils.ts

-10
Original file line numberDiff line numberDiff line change
@@ -1012,15 +1012,6 @@ function filterOutDeprecatedReportActions(reportActions: OnyxEntry<ReportActions
10121012
.map((entry) => entry[1]);
10131013
}
10141014

1015-
/**
1016-
* Helper for filtering out Report Actions that are either:
1017-
* - ReportPreview with shouldShow set to false
1018-
* - Action with parent action deleted
1019-
*/
1020-
function getFilteredReportActionsForReportView(actions: ReportAction[]) {
1021-
return actions.filter((action) => !isDeletedParentAction(action) && (!isReportPreviewAction(action) || action.shouldShow));
1022-
}
1023-
10241015
/**
10251016
* This method returns the report actions that are ready for display in the ReportActionsView.
10261017
* The report actions need to be sorted by created timestamp first, and reportActionID second
@@ -2542,7 +2533,6 @@ export {
25422533
getRemovedConnectionMessage,
25432534
getActionableJoinRequestPendingReportAction,
25442535
getReportActionsLength,
2545-
getFilteredReportActionsForReportView,
25462536
wasMessageReceivedWhileOffline,
25472537
shouldShowAddMissingDetails,
25482538
getJoinRequestMessage,

src/pages/home/ReportScreen.tsx

+8-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ import {getPersonalDetailsForAccountIDs} from '@libs/OptionsListUtils';
4040
import {getDisplayNameOrDefault} from '@libs/PersonalDetailsUtils';
4141
import {
4242
getCombinedReportActions,
43-
getFilteredReportActionsForReportView,
4443
getOneTransactionThreadReportID,
4544
isCreatedAction,
4645
isDeletedParentAction,
@@ -267,8 +266,14 @@ function ReportScreen({route, navigation}: ReportScreenProps) {
267266
const [currentUserAccountID = -1] = useOnyx(ONYXKEYS.SESSION, {selector: (value) => value?.accountID, canBeMissing: false});
268267
const [currentUserEmail] = useOnyx(ONYXKEYS.SESSION, {selector: (value) => value?.email, canBeMissing: false});
269268
const [isLoadingApp] = useOnyx(ONYXKEYS.IS_LOADING_APP, {canBeMissing: true});
270-
const {reportActions: unfilteredReportActions, linkedAction, sortedAllReportActions, hasNewerActions, hasOlderActions} = usePaginatedReportActions(reportID, reportActionIDFromRoute);
271-
const reportActions = getFilteredReportActionsForReportView(unfilteredReportActions);
269+
const {
270+
reportActions: reportActionsWithDeletedExpenses,
271+
linkedAction,
272+
sortedAllReportActions,
273+
hasNewerActions,
274+
hasOlderActions,
275+
} = usePaginatedReportActions(reportID, reportActionIDFromRoute);
276+
const reportActions = reportActionsWithDeletedExpenses.filter((value) => !isDeletedParentAction(value));
272277

273278
const [isBannerVisible, setIsBannerVisible] = useState(true);
274279
const [scrollPosition, setScrollPosition] = useState<ScrollPosition>({});

0 commit comments

Comments
 (0)