From 5942a3eaee623d29eb5be8c297f55737dc49af07 Mon Sep 17 00:00:00 2001 From: Yumin Cho Date: Thu, 25 Apr 2024 20:21:28 +0900 Subject: [PATCH] fix: deep copy nested object --- src/reducers/timetable/list.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/reducers/timetable/list.ts b/src/reducers/timetable/list.ts index 4fec1c9..5f530dc 100644 --- a/src/reducers/timetable/list.ts +++ b/src/reducers/timetable/list.ts @@ -97,6 +97,7 @@ const list = (state = initialState, action: LectureListAction) => { */ case CLEAR_SEARCH_LIST_LECTURES: { const newState = { ...state }; + newState.lists = { ...newState.lists }; newState.lists[LectureListCode.SEARCH].lectureGroups = null; return newState; } @@ -115,6 +116,7 @@ const list = (state = initialState, action: LectureListAction) => { const newLectures = lectures.filter((l) => l.id !== action.lecture.id); const newLectureGroups = groupLectures(newLectures); const newState = { ...state }; + newState.lists = { ...newState.lists }; newState.lists[LectureListCode.CART].lectureGroups = newLectureGroups; return newState; }