Description
A recent change (maplibre/maplibre-gl-js#6766) introduced into the way that maplibre-gl handles setMinZoom and setMaxZoom calls to prevent stale values means that these changes are applied immediately.
As such, a change in props from { minZoom: 1, maxZoom: 3 } to { minZoom: 5, maxZoom: 10 } can throw an error in Maplibre depending on the order in which these are updated. If setMinZoom is called first the new minZoom: 5 is greater than the current maxZoom: 3 and an error is thrown (https://github.com/maplibre/maplibre-gl-js/blob/main/src/ui/map.ts#L1154). Maybe there's an order to call these in that always works? Or we request an upstream function eg. setZoomConstraint({ min: x, max: y }) that changes both in one go?
Expected Behavior
No response
Steps to Reproduce
- Create a map with
{ ..., minZoom: 1, maxZoom: 3 } props
- Change props to
{ minZoom: 5, maxZoom: 10 }
- Note error thrown
Environment
Logs
No response