Scheduled polls use a stale focus-state snapshot

Author: OskarEichlerCreated Aug 30, 2026Updated Aug 30, 2026

Problem

startNextPoll reads const state = api.getState()[reducerPath] when it schedules a timeout, then the timeout callback checks state.config.focused. Redux state is immutable, so that callback keeps the focus value from scheduling time rather than the value when the poll actually fires.

If focus is lost after a poll has been scheduled, a subscription with skipPollingIfUnfocused: true still makes one network request. Only the subsequent timer sees the newer state. The existing multi-subscription test currently encodes this extra request as callsWithoutSkip + 1.

Expected

The timeout should read current API/query state when it fires. Losing focus before the deadline should skip that request, and removed cache entries should not be refetched through a stale substate reference.

This is related to the React Native background-polling concern in #5034 but is a focused correctness bug in the existing per-subscription option. I have a regression that loses focus only after the initial request has fulfilled and the poll is scheduled.