Skip to content

Commit 5c2873b

Browse files
authored
Merge pull request Expensify#64003 from mkzie2/mkzie2-issue/63816
fix: report briefly shown with 0,00 as amount and no receipt thumbnail when deleted
2 parents f6ccfc2 + 9002961 commit 5c2873b

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

src/components/Search/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,8 @@ function Search({queryJSON, currentSearchResults, lastNonEmptySearchResults, onS
519519
);
520520
}
521521

522-
if (shouldShowEmptyState(isDataLoaded, data.length, searchResults.search.type)) {
522+
const visibleDataLength = data.filter((item) => item.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || isOffline).length;
523+
if (shouldShowEmptyState(isDataLoaded, visibleDataLength, searchResults.search.type)) {
523524
return (
524525
<View style={[shouldUseNarrowLayout ? styles.searchListContentContainerStyles : styles.mt3, styles.flex1]}>
525526
<EmptySearchView

src/libs/SearchUIUtils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,13 +833,15 @@ function getReportSections(data: OnyxTypes.SearchResults['data'], metadata: Onyx
833833
const transactions = reportIDToTransactions[reportKey]?.transactions ?? [];
834834
const isIOUReport = reportItem.type === CONST.REPORT.TYPE.IOU;
835835

836+
const reportPendingAction = reportItem?.pendingAction ?? reportItem?.pendingFields?.preview;
836837
reportIDToTransactions[reportKey] = {
837838
...reportItem,
838839
action: getAction(data, allViolations, key),
839840
keyForList: reportItem.reportID,
840841
from: data.personalDetailsList?.[reportItem.accountID ?? CONST.DEFAULT_NUMBER_ID],
841842
to: reportItem.managerID ? data.personalDetailsList?.[reportItem.managerID] : emptyPersonalDetails,
842843
transactions,
844+
...(reportPendingAction ? {pendingAction: reportPendingAction} : {}),
843845
};
844846

845847
if (isIOUReport) {

src/types/onyx/SearchResults.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,15 @@ type SearchReport = {
179179

180180
/** The policy name to use for an archived report */
181181
oldPolicyName?: string;
182+
183+
/** Pending fields for the report */
184+
pendingFields?: {
185+
/** Pending action for the preview */
186+
preview?: OnyxCommon.PendingAction;
187+
};
188+
189+
/** Pending action for the report */
190+
pendingAction?: OnyxCommon.PendingAction;
182191
};
183192

184193
/** Model of report action search result */

0 commit comments

Comments
 (0)