From 65892898e12c1df5c329bfaeb9dd5c6874efbe2a Mon Sep 17 00:00:00 2001 From: MisRob Date: Sat, 9 Sep 2023 15:13:32 +0200 Subject: [PATCH 1/2] Don't show two loaders Fixes both global and local loaders being displayed when loading the classes page. --- kolibri/plugins/coach/assets/src/routes/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kolibri/plugins/coach/assets/src/routes/index.js b/kolibri/plugins/coach/assets/src/routes/index.js index 564fba720a..8b661483a4 100644 --- a/kolibri/plugins/coach/assets/src/routes/index.js +++ b/kolibri/plugins/coach/assets/src/routes/index.js @@ -26,7 +26,8 @@ export default [ path: '/classes', component: CoachClassListPage, handler(toRoute) { - store.dispatch('loading'); + // loading state is handled locally + store.dispatch('notLoading'); // if user only has access to one facility, facility_id will not be accessible from URL, // but always defaulting to userFacilityId would cause problems for multi-facility admins const facilityId = toRoute.query.facility_id || store.getters.userFacilityId; @@ -41,7 +42,6 @@ export default [ }); return; } - store.dispatch('notLoading'); }, error => store.dispatch('handleApiError', { error, reloadOnReconnect: true }) ); From 241837fb7f064b3d79ab8796829b1ea168b6ce1b Mon Sep 17 00:00:00 2001 From: MisRob Date: Sat, 9 Sep 2023 19:37:34 +0200 Subject: [PATCH 2/2] Fix missing global loader on root coach pages. Even though global/local loading state is set in some loading pages handlers, before running individual pages handlers, coach plugin fetches some data in global 'beforeRoute'. That takes significantly more time than individual handlers. Not having loading state set in this 'beforeRoute' caused seemingly missing global loader (even though it was displayed very briefly for individual handlers) --- kolibri/plugins/coach/assets/src/app.js | 1 + 1 file changed, 1 insertion(+) diff --git a/kolibri/plugins/coach/assets/src/app.js b/kolibri/plugins/coach/assets/src/app.js index 463a4b8bfd..b90931cdd9 100644 --- a/kolibri/plugins/coach/assets/src/app.js +++ b/kolibri/plugins/coach/assets/src/app.js @@ -28,6 +28,7 @@ class CoachToolsModule extends KolibriApp { redirectBrowser(); return; } + this.store.dispatch('loading'); const promises = []; // Clear the snackbar at every navigation to prevent it from re-appearing // when the next page component mounts.