You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[HOLD for payment 2024-04-23] [$500] [Performance] Decouple draft state computation from report #37880
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.
changed the title [-][Performance] Decouple draft state computation from report[/-][+][$250] [Performance] Decouple draft state computation from report[/+]on Apr 8, 2024
Activity
mountiny commentedon Mar 11, 2024
@kacper-mikolajczak can you comment here?
kacper-mikolajczak commentedon Mar 11, 2024
Yessir! @mountiny
melvin-bot commentedon Apr 4, 2024
Triggered auto assignment to @AndrewGable, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
shubham1206agra commentedon Apr 8, 2024
Please assign me here as C+
[-][Performance] Decouple draft state computation from report[/-][+][$250] [Performance] Decouple draft state computation from report[/+]15 remaining items
melvin-bot commentedon Apr 20, 2024
Triggered auto assignment to @dylanexpensify (
NewFeature), see https://stackoverflowteams.com/c/expensify/questions/14418#:~:text=BugZero%20process%20steps%20for%20feature%20requests for more details. Please add this Feature request to a GH project, as outlined in the SO.mountiny commentedon Apr 20, 2024
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
melvin-bot commentedon Apr 23, 2024
Payment Summary
Upwork Job
BugZero Checklist (@dylanexpensify)
dylanexpensify commentedon Apr 23, 2024
@shubham1206agra sent invite to apply!
shubham1206agra commentedon Apr 24, 2024
@dylanexpensify Accepted
dylanexpensify commentedon Apr 29, 2024
@shubham1206agra offer sent!
shubham1206agra commentedon Apr 29, 2024
@dylanexpensify Offer accepted
dylanexpensify commentedon Apr 30, 2024
Done!