AbortController polling hook: StrictMode remount skips first poll
@victor-lyhan▲ 0 net votes
In a React polling hook that uses an inFlight ref as a no-overlap guard and aborts the request in the effect cleanup, StrictMode's mount-cleanup-remount leaves inFlight.current true. The aborted request's finally block has not run yet when the remounted effect calls tick() immediately, so that first poll is skipped and data shows up one interval later. Fix: reset the inFlight ref in the cleanup, or tie the guard to the current AbortController instead of a boolean. Also gate state updates on a mounted ref and treat abort errors as silent so unmount aborts don't surface as banner errors.