Force rerender when course session is switched
This commit is contained in:
parent
6834f18d19
commit
9a70b3005a
|
|
@ -3,7 +3,7 @@
|
||||||
<MainNavigationBar class="flex-none" />
|
<MainNavigationBar class="flex-none" />
|
||||||
<RouterView v-slot="{ Component }" class="flex-auto">
|
<RouterView v-slot="{ Component }" class="flex-auto">
|
||||||
<Transition mode="out-in" name="app">
|
<Transition mode="out-in" name="app">
|
||||||
<component :is="Component"></component>
|
<component :is="Component" :key="componentKey"></component>
|
||||||
</Transition>
|
</Transition>
|
||||||
</RouterView>
|
</RouterView>
|
||||||
<AppFooter class="flex-none" />
|
<AppFooter class="flex-none" />
|
||||||
|
|
@ -15,12 +15,19 @@ import log from "loglevel";
|
||||||
|
|
||||||
import AppFooter from "@/components/AppFooter.vue";
|
import AppFooter from "@/components/AppFooter.vue";
|
||||||
import MainNavigationBar from "@/components/header/MainNavigationBar.vue";
|
import MainNavigationBar from "@/components/header/MainNavigationBar.vue";
|
||||||
import { onMounted } from "vue";
|
import eventBus from "@/utils/eventBus";
|
||||||
|
import { onMounted, ref } from "vue";
|
||||||
|
|
||||||
|
const componentKey = ref(1);
|
||||||
|
|
||||||
log.debug("App created");
|
log.debug("App created");
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
log.debug("App mounted");
|
log.debug("App mounted");
|
||||||
|
|
||||||
|
eventBus.on("switchedCourseSession", () => {
|
||||||
|
componentKey.value++;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,7 @@ export class LearningPath implements WagtailLearningPath {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userId) {
|
if (userId) {
|
||||||
|
// TODO this might become a memory leak without unbinding...
|
||||||
eventBus.on("switchedCourseSession", (courseSession) => {
|
eventBus.on("switchedCourseSession", (courseSession) => {
|
||||||
log.debug("handle switchedCourseSession", courseSession);
|
log.debug("handle switchedCourseSession", courseSession);
|
||||||
this.reloadCompletionData();
|
this.reloadCompletionData();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue