Skip to content

Commit

Permalink
Update our inClasses boolean when we fetch classes from the backend t…
Browse files Browse the repository at this point in the history
…o avoid mismatches in state.
  • Loading branch information
rtibbles committed Jul 30, 2024
1 parent 23d1316 commit 904ca1c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion kolibri/plugins/learn/assets/src/views/HomePage/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<script>
import { computed, getCurrentInstance } from 'kolibri.lib.vueCompositionApi';
import { get } from '@vueuse/core';
import { get, set } from '@vueuse/core';
import client from 'kolibri.client';
import urls from 'kolibri.urls';
import useUser from 'kolibri.coreVue.composables.useUser';
Expand All @@ -75,6 +75,7 @@
setResumableContentNodes,
} from '../../composables/useLearnerResources';
import { setContentNodeProgress } from '../../composables/useContentNodeProgress';
import { inClasses } from '../../composables/useCoreLearn';
import { PageNames } from '../../constants';
import AssignedLessonsCards from '../classes/AssignedLessonsCards';
import AssignedQuizzesCards from '../classes/AssignedQuizzesCards';
Expand Down Expand Up @@ -171,6 +172,9 @@
return client({ url: urls['kolibri:kolibri.plugins.learn:homehydrate']() }).then(
response => {
setClasses(response.data.classrooms);
// Update our hydrated class membership boolean in case it has changed
// since the learn page was opened.
set(inClasses, Boolean(response.data.classrooms.length));
setResumableContentNodes(
response.data.resumable_resources.results || [],
response.data.resumable_resources.more || null,
Expand Down

0 comments on commit 904ca1c

Please # to comment.