perf: App start improvement [INS-3957]
close INS-4026 INS-3957 objective: Reduce the App start duration
Changes
Loading strategy
- [x] use the
findBestRoutefunction to try to return the path with orgId and projectId in:- [x] initialEntry
- [x] organizationId indexLoader
- [x] sync task: submit action in useEffect instead of syncing in index route loader (organization index & organizationId index)
return deferred value in project loader
This solution is beneficial for both
app startandprojects change.
- [x] return deferred data in project loader and wait promise in component
Test
- [x] user has no cache data
- [x] user has cache data
have some console.log for testing now, will be deleted before merge
can you provide more evidence that this approach is addressing the lionshare of performance impact? from what i can see this PR is doing at least two things. in a perf PR please only focus on a single measurable improvement and give a rationale about why this perf change was chosen in context of other perf impacts which were also investigated.
eg.
thing a 2%
thing b 10%
thing c 88%
i chose c because its was worth optimizing.
can you provide more evidence that this approach is addressing the lionshare of performance impact? from what i can see this PR is doing at least two things. in a perf PR please only focus on a single measurable improvement and give a rationale about why this perf change was chosen in context of other perf impacts which were also investigated.
eg.
thing a 2% thing b 10% thing c 88% i chose c because its was worth optimizing.
Do you mean the two things is modity initial entry and add async task hooks? This is because if we only modify the initial entry, the logic in the organization and organizationId index route loader will not run, so I put the two changes together to make logic of the app be complete.
Switching between Organizations also is fast, but there's a split second when it still is not showing all the unsynced collections right after going to another project/organization.
@filfreire Thank you very much for your test.Not showing all the unsynced files right away is as expected, because we return a deferred data in react-router loader and wait the promise in component render phase.