The App works flawlessly without any problems. But I think re-running the calculations or functions again to calculate the stats for each tab is unnecessary. Instead, you can load the stats for all the tabs at once as soon as the user first clicks the custom app in the sidebar. Also, don't re-run them after every time one of the tabs is clicked, save data someplace and update it with a refresh button that the user can click. This button would obviously be triggerable after the first run after the user clicks the custom app in the sidebar.
So, the first run is when the user clicks the custom app in the sidebar. And Never after the first run, i.e. no re-runs after the user clicks the custom app sidebar button after the first run.
Save the stats after each update (After the first run and after each refresh button click run), so you don't have to re-run everything every time.
A refresh button to update stats after the first run, intrinsically triggerable any time after the first run. This button should be globally accessible in the custom app i.e. in all the tabs, or besides the tabs to make it more obvious.
One more thing, save the selection in the library tab between 'whole library' and 'my playlists'. Also, for the other selections like 'past 4 weeks', 'past 6 months', and 'All time', if you want. So, it can be used on re-runs including first runs as well. So, you don't have to change it to one thing or the other every time.
Yeah I was thinking about doing caching, would definitely help with limiting api calls aswell. When I have time ill try and implement something like this.
The App works flawlessly without any problems. But I think re-running the calculations or functions again to calculate the stats for each tab is unnecessary. Instead, you can load the stats for all the tabs at once as soon as the user first clicks the custom app in the sidebar. Also, don't re-run them after every time one of the tabs is clicked, save data someplace and update it with a refresh button that the user can click. This button would obviously be triggerable after the first run after the user clicks the custom app in the sidebar.
Lemme know what you think.