Skip to content

Commit

Permalink
fix(landing): Fix debug hillshade infinite loading. BM-1110 (#3360)
Browse files Browse the repository at this point in the history
### 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.
  • Loading branch information
Wentao-Kuang authored Oct 18, 2024
1 parent 9fa3681 commit 6655441
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/landing/src/components/debug.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6655441

Please sign in to comment.