Skip to content

Commit 025d44d

Browse files
committed
fix: report briefly shown with 0,00 as amount and no receipt thumbnail when deleted
1 parent c25867d commit 025d44d

4 files changed

Lines changed: 16 additions & 1 deletion

File tree

src/components/Search/index.tsx

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

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

src/libs/SearchUIUtils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,7 @@ function getReportSections(data: OnyxTypes.SearchResults['data'], metadata: Onyx
772772
from: data.personalDetailsList?.[reportItem.accountID ?? CONST.DEFAULT_NUMBER_ID],
773773
to: reportItem.managerID ? data.personalDetailsList?.[reportItem.managerID] : emptyPersonalDetails,
774774
transactions,
775+
pendingAction: reportItem?.pendingAction ?? reportItem?.pendingFields?.preview,
775776
};
776777

777778
if (isIOUReport) {

src/libs/actions/IOU.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7435,6 +7435,10 @@ function prepareToCleanUpMoneyRequest(transactionID: string, reportAction: OnyxT
74357435
);
74367436
}
74377437

7438+
if (shouldDeleteIOUReport && updatedIOUReport) {
7439+
updatedIOUReport.pendingAction = CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE;
7440+
}
7441+
74387442
if (updatedIOUReport) {
74397443
const lastVisibleAction = getLastVisibleAction(iouReport?.reportID, canUserPerformWriteAction, updatedReportAction);
74407444
const iouReportLastMessageText = getLastVisibleMessage(iouReport?.reportID, canUserPerformWriteAction, updatedReportAction).lastMessageText;

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)