openhuman icon indicating copy to clipboard operation
openhuman copied to clipboard

Bug: CoreStateProvider polling race — state update on unmounted component

Open Liohtml opened this issue 6 months ago • 0 comments

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.

Liohtml avatar May 16 '26 14:05 Liohtml