fix(cctv): stop the Dutch cameras landing on the map twice - #329
Open
meijbaard wants to merge 1 commit into
Open
fix(cctv): stop the Dutch cameras landing on the map twice#329meijbaard wants to merge 1 commit into
meijbaard wants to merge 1 commit into
Conversation
netherlands.ts was reached two ways: as its own key in RAW_REGION_FETCHERS, and through fetchEuropeCameras, which called it directly. GET concatenates whatever the regions return without deduplicating, so every Rijkswaterstaat camera was pushed twice — two pins on one spot, and `sources` reporting 52 cameras where there are 26. Measured on ?region=netherlands,europe before this change: Rijkswaterstaat 52, with all 26 ids appearing twice. After: 26, none twice. On ?region=all, which is what the frontend asks for, 35,004 cameras and 35,004 unique ids. Three parts, and the second is the one that is easy to miss: The call comes out of fetchEuropeCameras. The country has its own region key; fetching it inside Europe as well was the duplication. 'netherlands' gains a branch in getRegionsForBounds, explicit the way Utah and Oregon are. The broad europe box covers these latitudes but no longer carries the Dutch feed, so removing the call alone would have left a viewport over the Netherlands answering with no Dutch cameras at all — trading a visible bug for a silent one. GET deduplicates on id. Regions overlap by design, a bounding box can name both 'europe' and a country inside it, so this is a property of the merge rather than of any one source. Cameras without an id are passed through untouched; several of the inline fetchers are typed any[]. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
@meijbaard is attempting to deploy a commit to the Developing Osiris' projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
netherlands.tsis reached two ways: as its own key inRAW_REGION_FETCHERS, and throughfetchEuropeCameras, which callsfetchNetherlandsCameras()directly.GETconcatenates whatever the regions return without deduplicating, so every Rijkswaterstaat camera is pushed twice — two pins on one spot, andsourcesreporting 52 cameras where there are 26.Measured
?region=netherlands,europe→Rijkswaterstaat?region=all→ cameras / unique idsRijkswaterstaatRijkswaterstaatThree parts, and the second is the one that is easy to miss
The call comes out of
fetchEuropeCameras. The country has its own region key; fetching it inside Europe as well was the duplication.netherlandsgains a branch ingetRegionsForBounds, explicit the way Utah and Oregon already are. It was never in there — the broadeuropebox was carrying the Dutch feed for viewport queries. Removing the call alone would have left a viewport over the Netherlands answering with no Dutch cameras at all, trading a visible bug for a silent one. The box is the onenetherlands.tsalready filters the feed on.GETdeduplicates onid. Regions overlap by design — a bounding box can name botheuropeand a country inside it — so this is a property of the merge rather than of any one source, and it keeps the next source that gets registered twice from doing the same thing. Cameras without anidare passed through untouched; several of the inline fetchers are typedany[].Verifying
npm run lintruns out of heap on this repo onmastertoo, so it is not usable as a gate here.eslint src/app/api/cctv/route.tsreports the same 29 pre-existing findings before and after.🤖 Generated with Claude Code