Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/libs/TransactionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -579,11 +579,10 @@ function hasRoute(transaction: OnyxEntry<Transaction>, isDistanceRequestType?: b
}

function getAllReportTransactions(reportID?: string, transactions?: OnyxCollection<Transaction>): Transaction[] {
// `reportID` from the `/CreateDistanceRequest` endpoint return's number instead of string for created `transaction`.
// For reference, https://github.com/Expensify/App/pull/26536#issuecomment-1703573277.
// We will update this in a follow-up Issue. According to this comment: https://github.com/Expensify/App/pull/26536#issuecomment-1703591019.
const nonNullableTransactions: Transaction[] = Object.values(transactions ?? allTransactions ?? {}).filter((transaction): transaction is Transaction => !!transaction);
return nonNullableTransactions.filter((transaction) => `${transaction.reportID}` === `${reportID}`);
const reportTransactions: Transaction[] = Object.values(transactions ?? allTransactions ?? {}).filter(
(transaction): transaction is Transaction => !!transaction && transaction.reportID === reportID,
Comment on lines -586 to +583

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know they both should always be strings transaction.reportID === reportID but changin it to this makes a bit worried, should we loosen the equal sign to ==?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point, however this would give us only the first gain from removing unnecessary filter. I am fine with merging it with == now, and maybe let's do some more tests with === as a separate change so we can get more confidence around it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm okay, lets do === it should be all string

);
return reportTransactions;
}

function waypointHasValidAddress(waypoint: RecentWaypoint | Waypoint): boolean {
Expand Down