refactor: remove double feature fetch
Some checks failed
TrafficCue CI / check (push) Failing after 1m30s

This commit is contained in:
2025-10-22 10:00:21 +02:00
parent 001011cd23
commit 787b3b108b

View File

@ -113,18 +113,6 @@ export function watchLocation() {
location.lastUpdate = new Date(); location.lastUpdate = new Date();
const blacklist = ["path", "track", "raceway", "busway", "bus_guideway", "ferry"]; const blacklist = ["path", "track", "raceway", "busway", "bus_guideway", "ferry"];
getMeta(
{ lat: location.lat, lon: location.lng },
"transportation",
(f) => {
if(f.properties) {
return !blacklist.includes(f.properties["class"]);
}
return true;
}
).then((meta) => {
roadMetadata.current = meta;
});
getFeature( getFeature(
{ lat: location.lat, lon: location.lng }, { lat: location.lat, lon: location.lng },
"transportation", "transportation",
@ -136,6 +124,7 @@ export function watchLocation() {
} }
).then((feature) => { ).then((feature) => {
roadFeature.current = feature; roadFeature.current = feature;
roadMetadata.current = feature ? feature.properties : null;
snapLocation(); snapLocation();
}); });