651 calendar auto hide upon loads (#667)
* [#651] fix duplicated initialisatoin at login * [#651] prevent event overwrite when getting calendars list Co-authored-by: Camille Moussu <cmoussu@linagora.com>
This commit is contained in:
@@ -126,10 +126,25 @@ const CalendarSlice = createSlice({
|
||||
}>
|
||||
) => {
|
||||
state.pending = false;
|
||||
state.list = action.payload.importedCalendars;
|
||||
state.error = action.payload.errors.length
|
||||
? action.payload.errors
|
||||
: null;
|
||||
|
||||
Object.entries(action.payload.importedCalendars).forEach(
|
||||
([id, cal]) => {
|
||||
state.list[id] = {
|
||||
...cal,
|
||||
events: state.list[id]?.events || {},
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
// Remove calendars that no longer exist
|
||||
Object.keys(state.list).forEach((id) => {
|
||||
if (!action.payload.importedCalendars[id]) {
|
||||
delete state.list[id];
|
||||
}
|
||||
});
|
||||
}
|
||||
)
|
||||
.addCase(
|
||||
|
||||
Reference in New Issue
Block a user