fix: ConfirmModal-Zustand in Redux ausgelagert zur Stabilisierung
- Neuen confirmModalSlice erstellt für globale Steuerung des Bestätigungsdialogs - Zustand wird nun nicht mehr durch Re-Renders oder Komponentenneuaufbau zurückgesetzt - ConfirmModal in KueEinstellung.tsx vollständig an Redux angebunden - Flackern und automatisches Schließen nach 10–15 Sekunden dauerhaft behoben
This commit is contained in:
29
redux/slices/confirmModalSlice.ts
Normal file
29
redux/slices/confirmModalSlice.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||
|
||||
interface ConfirmModalState {
|
||||
open: boolean;
|
||||
}
|
||||
|
||||
const initialState: ConfirmModalState = {
|
||||
open: false,
|
||||
};
|
||||
|
||||
export const confirmModalSlice = createSlice({
|
||||
name: "confirmModal",
|
||||
initialState,
|
||||
reducers: {
|
||||
openConfirmModal: (state) => {
|
||||
state.open = true;
|
||||
},
|
||||
closeConfirmModal: (state) => {
|
||||
state.open = false;
|
||||
},
|
||||
setConfirmModal: (state, action: PayloadAction<boolean>) => {
|
||||
state.open = action.payload;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const { openConfirmModal, closeConfirmModal, setConfirmModal } =
|
||||
confirmModalSlice.actions;
|
||||
export default confirmModalSlice.reducer;
|
||||
Reference in New Issue
Block a user