From eaf12fbc8739d68dbcb8848d0ffbf440e0395199 Mon Sep 17 00:00:00 2001 From: Daniel Egger Date: Wed, 17 May 2023 18:33:05 +0200 Subject: [PATCH] Readd comments --- client/src/composables.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/client/src/composables.ts b/client/src/composables.ts index 11beb07f..46c9c912 100644 --- a/client/src/composables.ts +++ b/client/src/composables.ts @@ -1,7 +1,15 @@ import { useCourseSessionsStore } from "@/stores/courseSessions"; +import type { CourseSession } from "@/types"; import log from "loglevel"; export function useCurrentCourseSession() { + /** + * We often need the current course session in our components. + * With this composable we can get it easily. + * ATTENTION: The value is not reactive! So the components need to be re-rendered + * when the value changes. This is currently done with the "switchedCourseSession" + * event handler in the App.vue component. + */ const store = useCourseSessionsStore(); if (!store.currentCourseSession) { @@ -14,5 +22,6 @@ export function useCurrentCourseSession() { ); } - return store.currentCourseSession; + // return the current NON-REACTIVE course session + return store.currentCourseSession as CourseSession; }