Repository navigation
Description
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 9.1.43-7
Reproducible in staging?: Yes
Reproducible in production?: Unable to check, new feature
If this was caught during regression testing, add the test name, ID and link from TestRail: #60488
Email or phone of affected tester (no customers): applausetester+khcategory19@applause.expensifail.com
Issue reported by: Applause Internal Team
Device used: Mac 15.3 / Chrome
App Component: Workspace Settings
Action Performed:
Precondition:
- Workspace has per diem rates (use the file below).
- Go to staging.new.expensify.com
- Go to workspace settings > Per diem
- Click on the checkbox of any item.
- Note that the dropdown button appears first then the checkbox is only marked after a few seconds.
- On mweb Chrome, tap on the search field and search for a country.
- Note that typing on the search field is laggy and the search results delay.
Expected Result:
In Step 4, the checkbox will appear marked at the same time as when the dropdown button appears.
In Step 6, on mweb, typing on the search field will not be laggy and the search results will return instantly.
Actual Result:
In Step 4, the dropdown button appears first then the checkbox is only marked after a few seconds.
In Step 6, on mweb, typing on the search field is laggy and the search results delay.
When Step 3 to 6 are performed a few times, both web and mweb devices heat up a lot.
Workaround:
Unknown
Platforms:
- Android: App
- Android: mWeb Chrome
- iOS: App
- iOS: mWeb Safari
- iOS: mWeb Chrome
- Windows: Chrome
- MacOS: Chrome / Safari
- MacOS: Desktop
Screenshots/Videos
Bug6827135_1746860743185.web.mp4
Bug6827135_1746860743237.mweb_chrome.mp4
Bug6827135_1746860809922!logs-2025-05-10_07_06_29.572.txt
Bug6827135_1746860743195!German_Per_Diem_-Dependent_Tags___2.csv
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~021922118344435967366
- Upwork Job ID: 1922118344435967366
- Last Price Increase: 2025-06-10
Activity
melvin-bot commentedon May 10, 2025
Triggered auto assignment to @zanyrenney (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.melvin-bot commentedon May 10, 2025
Triggered auto assignment to @pecanoro (
DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.melvin-bot commentedon May 10, 2025
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon May 10, 2025
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
Eskalifer1 commentedon May 10, 2025
Hi, I found a bug that is partially related to this task as it also causes performance issues. Is it possible to create a separate task for that with my suggestion for that? I would have raised this issue in Slack, but I still haven't been granted access there, so I can't ask it there yet
2025-05-10.15.30.59.mov
Proposal
Please re-state the problem that we are trying to solve in this issue.
Per diem - Degraded performance in Per diem page
What is the root cause of that problem?
The problem of constant rendering of the component arises due to a change in the memory reference to the allRatesArray and allSubRates objects
App/src/pages/workspace/perDiem/WorkspacePerDiemPage.tsx
Lines 140 to 144 in 81b1b49
As a result, although the objects remain unchanged, they have a different memory reference and are therefore considered new objects, which, as a result, causes the subRatesList to change through useMemo:
App/src/pages/workspace/perDiem/WorkspacePerDiemPage.tsx
Line 196 in 81b1b49
Which, in turn, re-render the entire component:
What changes do you think we should make in order to solve the problem?
We need to add useMemo for these 2 objects
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
None
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
Eskalifer1 commentedon May 10, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Per diem - Degraded performance in Per diem page
What is the root cause of that problem?
If you take a closer look, the problem is not only for this page, but for all pages that use the useSearchResults hook, it's just that on other pages the operations are performed faster, which is why the difference is very small and hard to notice.
The problem is as follows:
App/src/hooks/useSearchResults.ts
Line 10 in 81b1b49
This hook uses useTransition to de-prioritize certain tasks, so an extra render is performed, and the change itself is performed in useEffect, resulting in only one change but 3 renders.
In turn, the button uses the local state of the component, not the state from the filteredValue,
App/src/pages/workspace/perDiem/WorkspacePerDiemPage.tsx
Line 129 in 81b1b49
Because of this, we have selectedPerDiem changing on the first render, useEffect is used for 2 renders, and useTransition is used for the third render, which changes the state of the table
App/src/pages/workspace/perDiem/WorkspacePerDiemPage.tsx
Line 284 in 81b1b49
App/src/pages/workspace/perDiem/WorkspacePerDiemPage.tsx
Lines 205 to 207 in 81b1b49
What changes do you think we should make in order to solve the problem?
The problem clearly arises because of useTransition, because it is through it that changes occur in useEffect that causes every single render, if you remove the logic from useTransition, then the hook will look like this:
With this approach, only one render will occur and the changes will be synchronized and occur simultaneously, but then the logic from useTransition is lost (I don't know what it is for, but I'm sure it is needed, because it would not be added for nothing).
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
None
What alternative solutions did you explore? (Optional)
Another way to avoid changing the useSearchResults hook is to set the “Selected” button to a value from the filteredSubRatesList instead of the local state, so that both the button and the table use the same value, but in this case, it may have a bad impact on the UX, since the changes will not occur immediately, but with a delay
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
56 remaining items
ikevin127 commentedon Jun 6, 2025
BugZero Checklist:
Bug classification
Source of bug:
Where bug was reported:
Who reported the bug:
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: Initial PR: [CP Staging] fix: search bar performance followup #61844, no need for comment since this is a follow-up to that initial PR.
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: N/A
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue:
Regression Test Proposal
Precondition: Workspace has per diem rates.
Do we agree 👍 or 👎.
ikevin127 commentedon Jun 6, 2025
@zanyrenney As per CME comment, only I require payment here, and payment will be $125 because we had regression after the initial PR. I will request payment through NewDot Manual Requests ✅ikevin127 commentedon Jun 9, 2025
Actually, to follow up on 👆, as just pointed out on Slack by @thesahindia, the PR for this issue caused
2more than 2 regressions, and given the guidelines mentioning -50% penalty for each regression, this would technically mean no payment due here I guess ? 😅With the above context in mind, I'd like to propose and ask for full bounty payment ($250) here, despite the two regressions, and here's the justification:
Given these two reasons, I think full payment is justified here, regardless of regressions which are expected with major UI restructuring, and given the significant performance increase delivered to the app.
Note: Here's a similar example of an issue (ref1, ref2), where we had more than 2 regressions / follow-ups, where the initial issue bounty was actually doubled due to feature complexity and prompt value delivery.
cc @mountiny for review / decision on payment request
melvin-bot commentedon Jun 9, 2025
Payment Summary
Upwork Job
BugZero Checklist (@zanyrenney)
mountiny commentedon Jun 10, 2025
This issue in itself has already been a follow up/ regression from the original big PR. While I sympathise with you and agree it has bee non-trivial task, I do think we need to encourage people to test more thoroughly as more regressions just lead to more time spend by the team trying to fix them, or to more payments to be issued for those regressions that should not have occurred in a first place.
As such I suggest payout of only $125 and not the full price.
[-][Due for payment 2025-06-09] [$250] Per diem - Degraded performance in Per diem page[/-][+][Due for payment 2025-06-09] [$125] Per diem - Degraded performance in Per diem page[/+]melvin-bot commentedon Jun 10, 2025
Upwork job price has been updated to $125
zanyrenney commentedon Jun 10, 2025
Lowering the payment since 2 regressions were caused.
zanyrenney commentedon Jun 10, 2025
Payment Summary
Upwork Job
BugZero Checklist (@zanyrenney)
ikevin127 commentedon Jun 10, 2025
There was only 1 reviewer due payment on this issue, see #61822 (comment).
zanyrenney commentedon Jun 10, 2025
Updated as per the comment above, thanks for letting me know @ikevin127
JmillsExpensify commentedon Jun 11, 2025
$125 approved for @ikevin127