fix: ignore "not found in store" race on boot in getCalendarDetailAsync.rejected

On hard reload, useCalendarLoader dispatches getCalendarDetailAsync(calId)
for selected calendars (cached in localStorage) BEFORE getCalendarsListAsync
has fulfilled. The detail thunk sees an empty state.calendars.list and
rejects with "Calendar X not found in store". The reject handler then sets
state.calendars.error, and HandleLogin redirects to /error.

Result: ~50% of reloads land on /error.

Treat this specific race-condition error like AbortError: ignore it. The
detail fetch is naturally re-issued by useCalendarLoader once the list is
loaded, so no functional regression.
This commit is contained in:
stanig2106
2026-04-29 18:38:33 +02:00
parent 0089fba30d
commit 28d1a2f8bb
+6 -1
View File
@@ -433,8 +433,13 @@ const CalendarSlice = createSlice({
state.pending = false
if (
action.payload?.message.includes('aborted') ||
action.error.name === 'AbortError'
action.error.name === 'AbortError' ||
action.payload?.message?.includes('not found in store')
) {
// "not found in store" is a boot race condition: useCalendarLoader
// dispatches getCalendarDetailAsync for cached selected calendars
// before getCalendarsListAsync has fulfilled. Safe to ignore — the
// detail fetch will be re-issued once the list is loaded.
return
}
state.error =