-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Now that user metrics are computed on the phone, agg metrics are computed on the server, and they both use a common format, MetricsTab can be simplified a lot. At the top, outside of the <MetricsTab> component definition let's define 2 async functions, computeUserMetrics and fetchAggMetrics. Obviously they differ in implementation but we can treat them the same now. Now let's condense all the useEffects and useMemos into one useEffect - if the timeline is in a loading state, pass - elif the timeline date range is < 14 days, call loadMoreDays, then pass - else, call computeUserMetrics and fetchAggMetrics sequentially; and when they finish, setUserMetrics and setAggMetrics. We no longer need any of the other stuff about distinguishing 'user' or 'aggregate' population, or parsing metrics after they are received. One thing that is new is `aggMetricsIsLoading`. The NavBar has a progress bar to help demonstrate when data is being lazy-loaded. It will now be active when either timelineIsLoading or aggMetricsIsLoading is truthy.
- Loading branch information
Showing
1 changed file
with
53 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters