🐛 Correctly copy objects

- Fixes timetable data corruption on timetable group change
This commit is contained in:
2023-06-04 16:34:30 +02:00
parent 8cdf5a691c
commit 776a7d1a42

View File

@ -155,7 +155,7 @@ export const parsedTimetable = computed(() => {
return timetable.value.data.map((day) => {
const parsedDay = [];
for (const lesson of day) {
let usedLesson = lesson;
let usedLesson = { ...lesson };
// Check if lesson has multiple options
// (timetable groups)
if (Array.isArray(lesson)) {
@ -171,7 +171,7 @@ export const parsedTimetable = computed(() => {
length: lesson[0].length || 1,
};
}
usedLesson = matchingLesson;
usedLesson = { ...matchingLesson };
}
// Duplicate the lesson if its length is > 1 for it
// to show up multiple times in the timetable view