From 776a7d1a420fceb893a9672616aceb3421bdec57 Mon Sep 17 00:00:00 2001 From: minie4 Date: Sun, 4 Jun 2023 16:34:30 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Correctly=20copy=20objects?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fixes timetable data corruption on timetable group change --- src/store.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/store.js b/src/store.js index 9a94e31..38894ee 100644 --- a/src/store.js +++ b/src/store.js @@ -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