From 3220338f21192e40a53e1aa2d004e7471d46bdf0 Mon Sep 17 00:00:00 2001 From: Andrew Hwang Date: Tue, 20 May 2025 16:00:13 -0700 Subject: [PATCH 1/2] fix recursion --- modules/react-mapbox/src/mapbox/mapbox.ts | 3 -- .../react-mapbox/test/components/map.spec.jsx | 36 +++++++++++++++++++ 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/modules/react-mapbox/src/mapbox/mapbox.ts b/modules/react-mapbox/src/mapbox/mapbox.ts index 260deee3a..c96fd1752 100644 --- a/modules/react-mapbox/src/mapbox/mapbox.ts +++ b/modules/react-mapbox/src/mapbox/mapbox.ts @@ -216,9 +216,6 @@ export default class Mapbox { this.props = props; const settingsChanged = this._updateSettings(props, oldProps); - if (settingsChanged) { - this._createProxyTransform(this._map); - } const sizeChanged = this._updateSize(props); const viewStateChanged = this._updateViewState(props, true); this._updateStyle(props, oldProps); diff --git a/modules/react-mapbox/test/components/map.spec.jsx b/modules/react-mapbox/test/components/map.spec.jsx index 3607230fb..dd8fdac2e 100644 --- a/modules/react-mapbox/test/components/map.spec.jsx +++ b/modules/react-mapbox/test/components/map.spec.jsx @@ -147,6 +147,42 @@ test('Map#controlled#no-update', t => { ); }); +test('Map#uncontrolled#delayedSettingsUpdate', async t => { + const root = createRoot(document.createElement('div')); + const mapRef = {current: null}; + + function App() { + const [settings, setSettings] = React.useState({ + maxPitch: 85 + }); + + async function onLoad() { + await sleep(1); + setSettings({maxPitch: 60}); + } + + return ( + { + onLoad(); + }} + /> + ); + } + + root.render(); + + await waitForMapLoad(mapRef); + await sleep(1); + + t.is(mapRef.current.getMaxPitch(), 60, 'maxPitch is updated'); +}); + test('Map#controlled#mirror-back', t => { const root = createRoot(document.createElement('div')); const mapRef = {current: null}; From e405c1ccfc5352eaed7d1a98fb6f13562ddc0f70 Mon Sep 17 00:00:00 2001 From: Chris Gervang Date: Fri, 24 Oct 2025 20:24:41 -0700 Subject: [PATCH 2/2] Update map.spec.jsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- modules/react-mapbox/test/components/map.spec.jsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/react-mapbox/test/components/map.spec.jsx b/modules/react-mapbox/test/components/map.spec.jsx index dd8fdac2e..827d491b2 100644 --- a/modules/react-mapbox/test/components/map.spec.jsx +++ b/modules/react-mapbox/test/components/map.spec.jsx @@ -168,9 +168,7 @@ test('Map#uncontrolled#delayedSettingsUpdate', async t => { mapboxAccessToken={MapboxAccessToken} initialViewState={{longitude: -100, latitude: 40, zoom: 4}} {...settings} - onLoad={() => { - onLoad(); - }} + onLoad={onLoad} /> ); }