From 6655441e48fd226f81daeb98987a95dd649128a7 Mon Sep 17 00:00:00 2001 From: Wentao Kuang Date: Fri, 18 Oct 2024 14:54:17 +1300 Subject: [PATCH] fix(landing): Fix debug hillshade infinite loading. BM-1110 (#3360) ### Motivation Debug.hillshade keep loading network because the skip check with un-prefix hillshade sourceId and get the hillshade layer been removed and added for every rendering. ### Modifications Correct the check sourceId with prefixed one. ### Verification Tested with locally build, was infinite loading before fix, and only load once after fix. --- packages/landing/src/components/debug.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/landing/src/components/debug.tsx b/packages/landing/src/components/debug.tsx index d96414c92..ccf12784b 100644 --- a/packages/landing/src/components/debug.tsx +++ b/packages/landing/src/components/debug.tsx @@ -335,11 +335,12 @@ export class Debug extends Component<{ map: maplibregl.Map }, DebugState> { if (currentLayer) map.removeLayer(HillShadeLayerId); return; } - if (currentLayer?.source === sourceId) return; + + const hillShadeSourceId = `${HillShadePrefix}${sourceId}`; + if (currentLayer?.source === hillShadeSourceId) return; // Hillshading from an existing raster-dem source gives very mixed results and looks very blury // so add a new source layer to generate from - const hillShadeSourceId = `${HillShadePrefix}${sourceId}`; const existingSource = map.getSource(hillShadeSourceId); if (existingSource == null) { const source = map.getSource(sourceId);