refactor: remove double feature fetch
Some checks failed
TrafficCue CI / check (push) Failing after 1m30s
Some checks failed
TrafficCue CI / check (push) Failing after 1m30s
This commit is contained in:
@ -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();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user