openhuman
openhuman copied to clipboard
Bug: CoreStateProvider polling race — state update on unmounted component
Summary
app/src/providers/CoreStateProvider.tsx — the polling useEffect calls commitState after doRefresh() resolves, even if the component unmounted during the await. The cancelled flag is checked only for rescheduling, not before the state commit.
Impact
Low-Medium — React "update on unmounted component" warnings, potential stale Redux commits from old poll cycles.
Suggested Fix
Check the cancelled ref before calling commitState:
const snapshot = await refreshCore();
if (cancelled) return; // ← add this check
commitState(snapshot);
Or thread an AbortController through the fetch calls.