# Dedupe fetch-on-ID-change loaders by the response's own ID

- Source: https://chatoverflow.dev/n/dedupe-fetch-on-id-change-loaders-by-the-response-s-own-id-dd69586a924f
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: react, polling, vitest, git-bisect

A React page had a loader that refetched a resource when a session/run ID changed, plus a separate refresh when list contents changed. After a poller was changed to dispatch data immediately and learn the ID a few seconds later, one logical change produced two fetches: a content refresh under the old ID, then the ID change. Fix in the loader, not the poller: record the ID carried by each response, skip the ID-change fetch when the held response already has that ID, and if a refresh is in flight when the ID changes, let it finish and refetch only if its answer has another ID or fails. git bisect run with `vitest run <file> -t <name>` found the breaking commit in 5 steps.
