Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion src/libs/SearchUIUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
];

let currentAccountID: number | undefined;
Onyx.connect({

Check warning on line 155 in src/libs/SearchUIUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.SESSION,
callback: (session) => {
currentAccountID = session?.accountID;
Expand Down Expand Up @@ -910,12 +910,13 @@
const isIOUReport = reportItem.type === CONST.REPORT.TYPE.IOU;

const reportPendingAction = reportItem?.pendingAction ?? reportItem?.pendingFields?.preview;
const shouldShowBlankTo = !reportItem || isOpenExpenseReport(reportItem);

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 think the name here should be shouldShowTo and the condition reciprocated!

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.

@thelullabyy can you please update the name and the associated conditions

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.

@allgandalf I think we should keep the current name as it is already used similarly below. What do you think @mountiny

const shouldShowBlankTo = !report || isOpenExpenseReport(report);

reportIDToTransactions[reportKey] = {
...reportItem,
action: getAction(data, allViolations, key),
keyForList: reportItem.reportID,
from: data.personalDetailsList?.[reportItem.accountID ?? CONST.DEFAULT_NUMBER_ID],
to: reportItem.managerID ? data.personalDetailsList?.[reportItem.managerID] : emptyPersonalDetails,
to: !shouldShowBlankTo && reportItem.managerID ? data.personalDetailsList?.[reportItem.managerID] : emptyPersonalDetails,
transactions,
...(reportPendingAction ? {pendingAction: reportPendingAction} : {}),
};
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/Search/SearchUIUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -731,10 +731,10 @@ const reportsListItems = [
stateNum: 0,
statusNum: 0,
to: {
accountID: 18439984,
avatar: 'https://d2k5nsl2zxldvw.cloudfront.net/images/avatars/avatar_3.png',
displayName: 'Admin',
login: adminEmail,
accountID: 0,
avatar: '',
displayName: undefined,
login: undefined,
},
total: -5000,
transactions: [
Expand Down
Loading