From faefd31ac3426ca37e7d97247df71f9214af11e1 Mon Sep 17 00:00:00 2001 From: stanig2106 Date: Wed, 29 Apr 2026 18:38:33 +0200 Subject: [PATCH] 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. --- src/features/Calendars/CalendarSlice.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/features/Calendars/CalendarSlice.ts b/src/features/Calendars/CalendarSlice.ts index d230fae..714ee88 100644 --- a/src/features/Calendars/CalendarSlice.ts +++ b/src/features/Calendars/CalendarSlice.ts @@ -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 =