-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix: max depth exceeded error when dynamically changing map settings #2535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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 ( | ||||||||||
| <Map | ||||||||||
| ref={mapRef} | ||||||||||
| mapLib={import('mapbox-gl-v3')} | ||||||||||
|
||||||||||
| mapboxAccessToken={MapboxAccessToken} | ||||||||||
| initialViewState={{longitude: -100, latitude: 40, zoom: 4}} | ||||||||||
| {...settings} | ||||||||||
| onLoad={() => { | ||||||||||
| onLoad(); | ||||||||||
| }} | ||||||||||
|
Comment on lines
+171
to
+173
|
||||||||||
| onLoad={() => { | |
| onLoad(); | |
| }} | |
| onLoad={onLoad} |
Copilot uses AI. Check for mistakes.
Copilot
AI
Oct 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using very short arbitrary sleeps (1ms) increases test flakiness; consider awaiting a specific condition (e.g., poll until mapRef.current.getMaxPitch() === 60) or using a higher-level helper instead of fixed tiny delays.
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Pessimistress do you know why we had this?