refactor: stabilize calendar loading effects and menubar redirect
- Memoize calendar range strings and stabilize effect deps - Guard updateDarkColor to avoid dispatch loops - Add resilient cache-clear handling with refs - Memoize calendar/temp ids to prevent rerenders - Update event handler hooks with missing deps - Add guards and dependency fixes across Calendar effects
This commit is contained in:
committed by
Benoit TELLIER
parent
990e290066
commit
ffe204d60b
@@ -40,8 +40,16 @@ interface RejectedError {
|
||||
export const getCalendarsListAsync = createAsyncThunk<
|
||||
{ importedCalendars: Record<string, Calendars>; errors: string }, // Return type
|
||||
void, // Arg type
|
||||
{ rejectValue: RejectedError } // ThunkAPI config
|
||||
>("calendars/getCalendars", async (_, { rejectWithValue }) => {
|
||||
{ rejectValue: RejectedError; state: any } // ThunkAPI config
|
||||
>("calendars/getCalendars", async (_, { rejectWithValue, getState }) => {
|
||||
const state = getState() as any;
|
||||
if (Object.keys(state.calendars.list).length > 0) {
|
||||
return {
|
||||
importedCalendars: state.calendars.list,
|
||||
errors: "",
|
||||
};
|
||||
}
|
||||
|
||||
try {
|
||||
const importedCalendars: Record<string, Calendars> = {};
|
||||
const user = (await getOpenPaasUser()) as Record<string, string>;
|
||||
@@ -106,15 +114,7 @@ export const getCalendarsListAsync = createAsyncThunk<
|
||||
}
|
||||
|
||||
normalizedCalendars.forEach(
|
||||
({
|
||||
cal,
|
||||
description,
|
||||
delegated,
|
||||
link,
|
||||
id,
|
||||
ownerId,
|
||||
visibility,
|
||||
}) => {
|
||||
({ cal, description, delegated, link, id, ownerId, visibility }) => {
|
||||
const ownerData = ownerDataMap.get(ownerId) || {
|
||||
firstname: "",
|
||||
lastname: "Unknown User",
|
||||
|
||||
Reference in New Issue
Block a user