From 607d5dc6dff64fcb44d21451d1160131bf676af7 Mon Sep 17 00:00:00 2001 From: Xiaoji Chen Date: Tue, 8 Apr 2025 09:10:48 -0700 Subject: [PATCH] wrap jumpTo as internal update (#2516) --- modules/react-mapbox/src/mapbox/mapbox.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/react-mapbox/src/mapbox/mapbox.ts b/modules/react-mapbox/src/mapbox/mapbox.ts index 83af7899..260deee3 100644 --- a/modules/react-mapbox/src/mapbox/mapbox.ts +++ b/modules/react-mapbox/src/mapbox/mapbox.ts @@ -340,6 +340,15 @@ export default class Mapbox { this._proxyTransform.$internalUpdate = false; this._fireDefferedEvents(); }; + // eslint-disable-next-line @typescript-eslint/unbound-method + const jumpTo = map.jumpTo; + map.jumpTo = (...args: Parameters) => { + // This method will fire view state change events immediately + this._proxyTransform.$internalUpdate = true; + jumpTo.apply(map, args); + this._proxyTransform.$internalUpdate = false; + return map; + }; // Insert code into map's event pipeline // eslint-disable-next-line @typescript-eslint/unbound-method const fireEvent = map.fire;