fixed multi select issue

This commit is contained in:
subnub
2025-01-11 06:56:10 -05:00
parent 1ab318fd2c
commit 7e624ffd40
+10 -5
View File
@@ -72,15 +72,12 @@ const selectedSlice = createSlice({
},
resetSelected: () => initialState,
setMultiSelectMode: (state, action: PayloadAction<MainSecionType[]>) => {
const currentSelection = state.mainSection;
const currentSelection = { ...state.mainSection };
state.mainSection = { type: "", id: "", file: null, folder: null };
const selects = action.payload;
if (currentSelection.id !== "") {
state.multiSelectMap[currentSelection.id] = currentSelection;
state.multiSelectCount++;
}
const selectsIds = selects.map((select) => select.id);
for (const select of selects) {
if (
@@ -102,6 +99,14 @@ const selectedSlice = createSlice({
state.multiSelectCount++;
}
}
if (
currentSelection.id !== "" &&
!selectsIds.includes(currentSelection.id)
) {
state.multiSelectMap[currentSelection.id] = currentSelection;
state.multiSelectCount++;
}
},
resetMultiSelect: (state) => {
state.multiSelectMode = false;