-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[HOLD for payment 2024-04-23] [$500] [Performance] Decouple draft state computation from report #37880
Comments
@kacper-mikolajczak can you comment here? |
Yessir! @mountiny |
Triggered auto assignment to @AndrewGable, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
Please assign me here as C+ |
Job added to Upwork: https://www.upwork.com/jobs/~012397339f4d656420 |
Current assignee @shubham1206agra is eligible for the External assigner, not assigning anyone new. |
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results. If a regression has occurred and you are the assigned CM follow the instructions here. If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future. |
@AndrewGable, @shubham1206agra, @kacper-mikolajczak Whoops! This issue is 2 days overdue. Let's get this updated quick! |
Melvin, PR was merged already |
@mountiny Can you bump the price of this issue to $500, as this issue was created before the change? |
Upwork job price has been updated to $500 |
Triggered auto assignment to @dylanexpensify ( |
I am fine with the price as it was complex change and it was made before the price change too. $500 to @shubham1206agra once ready @dylanexpensify |
Payment Summary
BugZero Checklist (@dylanexpensify)
|
@shubham1206agra sent invite to apply! |
@dylanexpensify Accepted |
@shubham1206agra offer sent! |
@dylanexpensify Offer accepted |
Done! |
Problem
Whenever a user starts to type a new message in Composer, the hasDraft state inside current Report object needs to be updated. The state is later used in LHN to determine if a draft indicator (pencil icon) should be displayed.
Calculations performed by the app to acquire updated hasDraft state are costly. It is caused by the fact that the hasDraft state is a property of a Report object which is then part of the entire list of reports user has access to (14k on testing account). Change of a single report causes list to be invalidated, making costly calculations of getOrderedReportIDs inside SidebarLinksData (component that resides on top of LHN) to run again.
❗ The getOrderedReportIDs calculations might take a few hundred ms, up to a few seconds depending on device and number of reports passed to the function. It is a severe execution overhead, considering how often user starts typing new message during regular conversation.
Solution
The hasDraft state can be decoupled from Report object and stored as an individual entry (or list of entries for many reports) under separate Onyx key. Such a solution should help us avoid invalidating the entire list of reports on every new message being typed, thus not triggering costly re-calculation of getOrderedReportIDs.
In Onyx, the REPORT_DRAFT_COMMENT key exists and serves similar purpose as hasDraft. Considering how hasDraft is used (to display draft indicator) it should not be an issue to re-use REPORT_DRAFT_COMMENT key for such functionality. It is mostly an implementation detail, but this way we are reducing app complexity and state redundancy.
From : @kacper-mikolajczak here
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: