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.
This commit is contained in:
Muhammad Qasim Gulzar
2025-07-24 12:10:48 +05:00
committed by GitHub
parent 5b7efc65bc
commit 74e671d08b

View File

@@ -155,7 +155,7 @@ const slice = createSlice({
state.sectionsList = state.sectionsList.map((section) => {
if (section.id === payload.parentLocator) {
section.childInfo.children = [
...section.childInfo.children,
...section.childInfo.children.filter(child => child.id !== payload.data.id), // Filter to avoid duplicates
payload.data,
];
}