Skip to content

Commit 74e671d

Browse files
authored
fix: Course outline — issue when editing Section/Subsection/Unit name, and executing an action on the page (#2275)
When editing the title of a section, subsection or unit name, if someone created a new subsection, it would be duplicated and created twice. This change filters out the duplicate entry and eliminates the issue.
1 parent 5b7efc6 commit 74e671d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/course-outline/data/slice.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ const slice = createSlice({
155155
state.sectionsList = state.sectionsList.map((section) => {
156156
if (section.id === payload.parentLocator) {
157157
section.childInfo.children = [
158-
...section.childInfo.children,
158+
...section.childInfo.children.filter(child => child.id !== payload.data.id), // Filter to avoid duplicates
159159
payload.data,
160160
];
161161
}

0 commit comments

Comments
 (0)