feat: enhance flight tracking with improved API handling, metadata, and performance optimizations

This commit is contained in:
Kewonit
2026-02-14 13:14:43 +05:30
parent b3f20b7659
commit 08be8e1267
7 changed files with 338 additions and 132 deletions

View File

@ -95,6 +95,31 @@ export const Map = forwardRef<MapRef, MapProps>(function Map(
useEffect(() => {
if (!mapInstance || !isLoaded) return;
mapInstance.setStyle(mapStyle as maplibregl.StyleSpecification | string);
// Re-apply terrain/sky after style load (MapLibre can drop these on setStyle)
const applyTerrain = () => {
if (typeof mapStyle === "object" && "terrain" in mapStyle) {
const spec = mapStyle as Record<string, unknown>;
try {
mapInstance.setTerrain(
spec.terrain as maplibregl.TerrainSpecification,
);
} catch {
/* terrain source not yet loaded */
}
} else {
try {
mapInstance.setTerrain(null);
} catch {
/* no terrain to remove */
}
}
};
mapInstance.once("style.load", applyTerrain);
return () => {
mapInstance.off("style.load", applyTerrain);
};
}, [mapInstance, isLoaded, mapStyle]);
const ctx = useMemo(