Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/style/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4306,6 +4306,10 @@ class Style extends Evented<MapEvents> {
this._force3DLayerUpdate();
const parameters = this._getTransitionParameters({duration: 0});
terrain.updateTransitions(parameters);
// Evaluate the terrain properties synchronously so that consumers such as
// Terrain#update can access them before the next Style#update runs (#13665).
const evaluationParameters = new EvaluationParameters(this.z || 0, {...parameters, worldview: this.map.getWorldview()});
terrain.recalculate(evaluationParameters);
}

_force3DLayerUpdate() {
Expand Down
7 changes: 7 additions & 0 deletions test/unit/terrain/terrain.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,13 @@ describe('Elevation', () => {
});
});

test('mapbox-gl-js#13665: removeSource before the first render under globe projection does not throw', async () => {
const map = createMap({projection: 'globe'});
await waitFor(map, 'style.load');
map.addSource('repro-src', {type: 'geojson', data: {type: 'FeatureCollection', features: []}});
expect(() => map.removeSource('repro-src')).not.toThrowError();
});

test('style diff=false removes dem source', async () => {
const map = createMap();
await waitFor(map, "style.load");
Expand Down
Loading