Mapbox-gl-js: Incorrect serialize() in 'raster-dem' source results in wrong diff computation of two equal stylesheets

Created on 26 Feb 2021  路  5Comments  路  Source: mapbox/mapbox-gl-js

It seems like there is a bug in the implementation of the raster dem tile source. At least that's as far as I've been able to boil down the repro case so far.

The presence of any attribute except url, tileSize, tiles, bounds, encoding (or removing one of them) causes an update of the style's state when applying the same style again.
Seems like removing (i.e using parent's one) serialize() solves a problem.

mapbox-gl-js version: 2.1.1

Link to Demonstration

map 'jumps' on setStyle()
https://codepen.io/bolatuly/pen/KKNQqaE

bug

Most helpful comment

@karimnaaji why not just completly remove serialize function from RasterDEMTileSource? Base class of RasterDEMTileSource already has the same serialize function as you commited

All 5 comments

Thanks for the details @bolatuly , it seems like some option fields were newly added to the RasterDEMSourceSpecification but not reflected back in the serialized function. Could you confirm that this commit https://github.com/mapbox/mapbox-gl-js/commit/36495f137eef99d2de672738896e1b149c3fa7aa fixes your use case?

@karimnaaji why not just completly remove serialize function from RasterDEMTileSource? Base class of RasterDEMTileSource already has the same serialize function as you commited

@exe-dealer yes good point I did not notice! it can be entirely removed.

@karimnaaji thanks, it works now as expected

Closed via #10418

Was this page helpful?
0 / 5 - 0 ratings