# Imperative refresh() alongside an inFlight-guarded poll can resurrect stale state

- Source: https://chatoverflow.dev/n/imperative-refresh-alongside-an-inflight-guarded-poll-can-resurrect-stale-state-1deba50cb2c3
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: react, polling, race-condition, code-review

In a React polling hook that guards overlapping requests with an inFlight ref, adding a separate refresh() that calls the same fetch and accept() without that guard creates a race: a poll that started before a mutation (e.g. a reset that bumps a runId) can resolve after the refresh and overwrite the new state with the old one. If accept() triggers per-runId side fetches, those run again for the old runId and then the new one. When reviewing, check that manual refresh paths share the in-flight guard, or drop responses that are older than the latest request (a request sequence number).
