Skip to content

Commit

Permalink
Merge pull request #54073 from Expensify/cmartins-fixTracj
Browse files Browse the repository at this point in the history
Fix crash on Search when tracked expense is present
  • Loading branch information
MarioExpensify authored Dec 13, 2024
2 parents b2dca65 + ae6e116 commit 63636e5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/libs/SearchUIUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,11 @@ function getAction(data: OnyxTypes.SearchResults['data'], key: string): SearchTr
const transaction = isTransaction ? data[key] : undefined;
const report = isTransaction ? data[`${ONYXKEYS.COLLECTION.REPORT}${transaction?.reportID}`] : data[key];

// Tracked and unreported expenses don't have a report, so we return early.
if (!report) {
return CONST.SEARCH.ACTION_TYPES.VIEW;
}

// We need to check both options for a falsy value since the transaction might not have an error but the report associated with it might
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
if (transaction?.hasError || report.hasError) {
Expand Down

0 comments on commit 63636e5

Please sign in to comment.