fix: resolve Next.js docker build endpoints and handle async map icons

Former-commit-id: 6241ea44db
This commit is contained in:
anoracleofra-code
2026-03-09 00:37:08 -06:00
parent 197d37ae5a
commit 19a0ef1c70
5 changed files with 59 additions and 5 deletions
+23 -1
View File
@@ -373,15 +373,37 @@ const MaplibreViewer = ({ data, activeLayers, onEntityClick, flyToLocation, sele
const onMapLoad = useCallback((e: any) => {
const map = e.target;
// Track which images are still loading so we can retry on styleimagemissing
const pendingImages: Record<string, string> = {};
const loadImg = (id: string, url: string) => {
if (!map.hasImage(id)) {
pendingImages[id] = url;
const img = new Image();
img.crossOrigin = "anonymous";
img.src = url;
img.onload = () => map.addImage(id, img);
img.onload = () => {
if (!map.hasImage(id)) map.addImage(id, img);
delete pendingImages[id];
};
}
};
// Suppress "image not found" warnings — retry when the async load finishes
map.on('styleimagemissing', (ev: any) => {
const id = ev.id;
const url = pendingImages[id];
if (url) {
const img = new Image();
img.crossOrigin = "anonymous";
img.src = url;
img.onload = () => {
if (!map.hasImage(id)) map.addImage(id, img);
delete pendingImages[id];
};
}
});
// Legacy generic plane icons (still used as fallbacks)
loadImg('svgPlaneCyan', svgPlaneCyan);
loadImg('svgPlaneYellow', svgPlaneYellow);