refactor(Center): 重构投资规划中心日历与事件管理
This commit is contained in:
@@ -215,6 +215,14 @@ const planningSlice = createSlice({
|
||||
state.allEvents = state.allEvents.filter(e => e.id !== action.payload);
|
||||
state.lastUpdated = Date.now();
|
||||
},
|
||||
/** 乐观更新事件(编辑时使用) */
|
||||
optimisticUpdateEvent: (state, action: PayloadAction<InvestmentEvent>) => {
|
||||
const index = state.allEvents.findIndex(e => e.id === action.payload.id);
|
||||
if (index !== -1) {
|
||||
state.allEvents[index] = action.payload;
|
||||
state.lastUpdated = Date.now();
|
||||
}
|
||||
},
|
||||
},
|
||||
extraReducers: (builder) => {
|
||||
builder
|
||||
@@ -277,6 +285,7 @@ export const {
|
||||
optimisticAddEvent,
|
||||
replaceEvent,
|
||||
removeEvent,
|
||||
optimisticUpdateEvent,
|
||||
} = planningSlice.actions;
|
||||
|
||||
export default planningSlice.reducer;
|
||||
|
||||
Reference in New Issue
Block a user