Description:
This issue is part of investigations rooted from this slack thread. Amongst our findings, we discovered that getOrderedReportIDs is being called a lot of times and each call to this function is really expensive. Upon investigation, it occurred to us that the number of calls to getOrderedReportIDs is legit based on the actions. For eg, consider a case where we open a report which has expenses, click on a expense, it opens the expenses list, clicking on one expense, navigates us to the detail. Now, navigate back until you're on LHN. This is roughly 6-7 steps and we have useReportID being re-rendered 6-7 times for this set of actions because of the currentReportID being changed, which seems the correct behaviour.
Now, if we can reduce the impact of this re-render by not re-calculating getOrderedReportIDs function on mobile devices because in the above case, while we are on web and desktop, we attach an item in LHN when we click on an expense, which happens because we re-calculate getOrderedReportIDs each time the currentReportID changes if it's not already calculated. Also, when we navigate away from that new LHN item it is removed from the LHN.
Now, on mobile this is not important because when we click on an expense from ReportScreen, we are navigating to another screen, so LHN is never displayed and we don't need bother re-calculating getOrderedReportIDs on mobile.
Issue Owner
Current Issue Owner: @
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~0133e161250d414c82
- Upwork Job ID: 1825736030332418485
- Last Price Increase: 2024-08-20
Description:
This issue is part of investigations rooted from this slack thread. Amongst our findings, we discovered that
getOrderedReportIDsis being called a lot of times and each call to this function is really expensive. Upon investigation, it occurred to us that the number of calls togetOrderedReportIDsis legit based on the actions. For eg, consider a case where we open a report which has expenses, click on a expense, it opens the expenses list, clicking on one expense, navigates us to the detail. Now, navigate back until you're on LHN. This is roughly 6-7 steps and we haveuseReportIDbeing re-rendered 6-7 times for this set of actions because of thecurrentReportIDbeing changed, which seems the correct behaviour.Now, if we can reduce the impact of this re-render by not re-calculating
getOrderedReportIDsfunction on mobile devices because in the above case, while we are on web and desktop, we attach an item in LHN when we click on an expense, which happens because we re-calculategetOrderedReportIDseach time thecurrentReportIDchanges if it's not already calculated. Also, when we navigate away from that new LHN item it is removed from the LHN.Now, on mobile this is not important because when we click on an expense from ReportScreen, we are navigating to another screen, so LHN is never displayed and we don't need bother re-calculating
getOrderedReportIDson mobile.Issue Owner
Current Issue Owner: @Upwork Automation - Do Not Edit