mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 10:24:02 +00:00
fetchTile coalesced concurrent requests for one tile onto a single upstream fetch, but that fetch ran on the first caller's signal. When the first request was abandoned (an older pan), every joined request lost a tile it still needed; and a joined caller that aborted stayed subscribed until the shared fetch finished. A flight now owns its AbortController and counts waiters, the pattern the weather and wind providers use. Each caller's own abort rejects that caller at once; the upstream fetch is cancelled only when the last waiter leaves, and a later request after that starts a fresh fetch. Regression tests (fail on the previous tiles.js, pass now): a joined request survives the first caller aborting with one upstream request; a joined caller that aborts leaves at once while the first still gets the tile; both waiters leaving cancels the owned fetch. Reported by kvnloo in review. Co-Authored-By: Claude Opus 5.5 <[email protected]>