Skip to content
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

Fixed attempt of buckets update before map first render #13377

Merged
merged 1 commit into from
Jan 2, 2025

Conversation

msereniti
Copy link
Contributor

Time to time, randomly Datadog RUM that is monitoring our application FE reports the following error

TypeError: undefined is not an object (evaluating 'i.style.listImages')
  at updateBuckets @ https://example.com/_next/static/chunks/153e222f-eb05776e76b311d1.js:8:55922
  at refreshFeatureState @ https://example.com/_next/static/chunks/153e222f-eb05776e76b311d1.js:8:55812
  at initializeTileState @ https://example.com/_next/static/chunks/153e222f-eb05776e76b311d1.js:8:68593
  at _tileLoaded @ https://example.com/_next/static/chunks/153e222f-eb05776e76b311d1.js:8:73285
  at u @ https://example.com/_next/static/chunks/153e222f-eb05776e76b311d1.js:8:27141
  at processTask @ https://example.com/_next/static/chunks/153e222f-eb05776e76b311d1.js:7:292692
  at receive @ https://example.com/_next/static/chunks/153e222f-eb05776e76b311d1.js:7:292534

As Painter style property is being initialised in the render method instead of constructor, it seems that updateBuckets might be occasionally called even before the first map render when painter is not ready to do their job.

Launch Checklist

  • Make sure the PR title is descriptive and preferably reflects the change from the user's perspective.
  • Add additional detail and context in the PR description (with screenshots/videos if there are visual changes).
  • Manually test the debug page. – irrelevant
  • Write tests for all new functionality and make sure the CI checks pass. – irrelevant
  • Document any changes to public APIs. – irrelevant
  • Post benchmark scores if the change could affect performance. – irrelevant
  • Tag @mapbox/map-design-team @mapbox/static-apis if this PR includes style spec API or visual changes. – irrelevant
  • Tag @mapbox/gl-native if this PR includes shader changes or needs a native port. – irrelevant

Time to time, randomly Datadog RUM that is monitoring our application FE reports the following error

```
TypeError: undefined is not an object (evaluating 'i.style.listImages')
  at updateBuckets @ https://example.com/_next/static/chunks/153e222f-eb05776e76b311d1.js:8:55922
  at refreshFeatureState @ https://example.com/_next/static/chunks/153e222f-eb05776e76b311d1.js:8:55812
  at initializeTileState @ https://example.com/_next/static/chunks/153e222f-eb05776e76b311d1.js:8:68593
  at _tileLoaded @ https://example.com/_next/static/chunks/153e222f-eb05776e76b311d1.js:8:73285
  at u @ https://example.com/_next/static/chunks/153e222f-eb05776e76b311d1.js:8:27141
  at processTask @ https://example.com/_next/static/chunks/153e222f-eb05776e76b311d1.js:7:292692
  at receive @ https://example.com/_next/static/chunks/153e222f-eb05776e76b311d1.js:7:292534
```

As `Painter` `style` property is being initialised in the `render` method instead of `constructor`, it seems that `updateBuckets` might be occasionally called even before the first map render when painter is not ready to do their job.
@msereniti msereniti requested a review from a team as a code owner December 30, 2024 21:27
@CLAassistant
Copy link

CLAassistant commented Dec 30, 2024

CLA assistant check
All committers have signed the CLA.

@underoot underoot merged commit f03200d into mapbox:main Jan 2, 2025
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants