Skip to content

Commit

Permalink
Fix loading data management
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexVelezLl committed Nov 19, 2024
1 parent dca436f commit e84fa8c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 23 deletions.
6 changes: 6 additions & 0 deletions kolibri/plugins/coach/assets/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ class CoachToolsModule extends KolibriApp {
PageNames.QUIZ_SECTION_ORDER,
PageNames.QUIZ_BOOK_MARKED_RESOURCES,
PageNames.QUIZ_LEARNER_REPORT,
PageNames.LESSON_SUMMARY,
PageNames.LESSON_SUMMARY_BETTER,
PageNames.LESSON_SELECT_RESOURCES,
PageNames.LESSON_EDIT_DETAILS_BETTER,
PageNames.LESSON_PREVIEW_SELECTED_RESOURCES,
PageNames.LESSON_PREVIEW_RESOURCE,
];
// If we're navigating to the same page for a quiz summary page, don't set loading
if (
Expand Down
19 changes: 0 additions & 19 deletions kolibri/plugins/coach/assets/src/routes/lessonsRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
showLessonResourceBookmarks,
showLessonResourceBookmarksMain,
} from '../modules/lessonResources/handlers';
import { showLessonSummaryPage } from '../modules/lessonSummary/handlers';
import { PageNames } from '../constants';

import { useLessons } from '../composables/useLessons';
Expand Down Expand Up @@ -108,15 +107,6 @@ export default [
name: PageNames.LESSON_SUMMARY,
path: CLASS + LESSON + '/:tabId?',
component: LessonSummaryPage,
handler(toRoute, fromRoute) {
if (
fromRoute.name !== PageNames.LESSON_SUMMARY ||
toRoute.params.lessonId !== fromRoute.params.lessonId
) {
return showLessonSummaryPage(store, toRoute.params);
}
store.dispatch('notLoading');
},
meta: {
titleParts: ['LESSON_NAME', 'CLASS_NAME'],
},
Expand All @@ -128,15 +118,6 @@ export default [
props: {
isTemp: true,
},
handler(toRoute, fromRoute) {
if (
fromRoute.name !== PageNames.LESSON_SUMMARY ||
toRoute.params.lessonId !== fromRoute.params.lessonId
) {
return showLessonSummaryPage(store, toRoute.params);
}
store.dispatch('notLoading');
},
meta: {
titleParts: ['LESSON_NAME', 'CLASS_NAME'],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,13 @@
import { mapState, mapActions, mapMutations } from 'vuex';
import commonCoreStrings from 'kolibri/uiText/commonCoreStrings';
import useSnackbar from 'kolibri/composables/useSnackbar';
import { computed, getCurrentInstance, watch } from '@vue/composition-api';
import commonCoach from '../../common';
import CoachAppBarPage from '../../CoachAppBarPage';
import ReportsControls from '../../common/ReportsControls';
import { REPORTS_LESSON_TABS_ID, ReportsLessonTabs } from '../../../constants/tabsConstants';
import { PageNames } from '../../../constants';
import { showLessonSummaryPage } from '../../../modules/lessonSummary/handlers';
import LessonResourcesTable from './tables/LessonResourcesTable';
import LessonLearnersTable from './tables/LessonLearnersTable';
import LessonOptionsDropdownMenu from './LessonOptionsDropdownMenu';
Expand All @@ -118,8 +120,16 @@
},
mixins: [commonCoach, commonCoreStrings],
setup() {
const store = getCurrentInstance().proxy.$store;
const routeParams = computed(() => store.state.route.params);
const lessonId = computed(() => routeParams.value.lessonId);
showLessonSummaryPage(store, routeParams.value);
watch(lessonId, () => showLessonSummaryPage(store, routeParams.value));
const { createSnackbar, clearSnackbar } = useSnackbar();
return { createSnackbar, clearSnackbar };
return { lessonId, createSnackbar, clearSnackbar };
},
props: {
editable: {
Expand Down Expand Up @@ -151,9 +161,6 @@
loading() {
return this.$store.state.core.loading;
},
lessonId() {
return this.$route.params.lessonId;
},
lessonSelectionRootPage() {
if (this.isTemp) {
return this.classRoute(PageNames.LESSON_SELECT_RESOURCES, {
Expand Down

0 comments on commit e84fa8c

Please sign in to comment.