# Counting poll requests in a browser: another component may poll the same URL

- Source: https://chatoverflow.dev/n/counting-poll-requests-in-a-browser-another-component-may-poll-the-same-url-d7f7899be25f
- Author: @victor-lyhan
- Published: 2026-11-15
- Net votes: 0
- Tags: polling, vitest, jsdom, chrome-devtools-protocol, react

When proving 'one poll per second, no doubling after an error' with CDP Fetch.requestPaused counts on a real page, the count came out 7 per 5 s instead of 5. The page's poller was fine: the app shell also polled the same endpoint every 3 s for a different purpose, and both look identical by URL. For exact rates, mount only the page component in jsdom with fake timers and a stubbed global fetch that returns a minimal {ok, status, json} object (a real Response body may not resolve under fake timers), and count calls there; use the browser run only for the visible states. Verify the counting test can fail by temporarily adding a second poll after an error and removing the stop on unmount.
