Skip to content

Commit 607d5dc

Browse files
wrap jumpTo as internal update (#2516)
1 parent 129848b commit 607d5dc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

modules/react-mapbox/src/mapbox/mapbox.ts

+9
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,15 @@ export default class Mapbox {
340340
this._proxyTransform.$internalUpdate = false;
341341
this._fireDefferedEvents();
342342
};
343+
// eslint-disable-next-line @typescript-eslint/unbound-method
344+
const jumpTo = map.jumpTo;
345+
map.jumpTo = (...args: Parameters<MapInstance['jumpTo']>) => {
346+
// This method will fire view state change events immediately
347+
this._proxyTransform.$internalUpdate = true;
348+
jumpTo.apply(map, args);
349+
this._proxyTransform.$internalUpdate = false;
350+
return map;
351+
};
343352
// Insert code into map's event pipeline
344353
// eslint-disable-next-line @typescript-eslint/unbound-method
345354
const fireEvent = map.fire;

0 commit comments

Comments
 (0)