Skip to content

Commit 159be52

Browse files
authored
Fixed attempt of buckets update before map first render
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.
1 parent 5c1af30 commit 159be52

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/source/tile.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,7 @@ class Tile {
615615

616616
updateBuckets(painter: Painter, isBrightnessChanged?: boolean) {
617617
if (!this.latestFeatureIndex) return;
618+
if (!painter.style) return;
618619

619620
const vtLayers = this.latestFeatureIndex.loadVTLayers();
620621
const availableImages = painter.style.listImages();

0 commit comments

Comments
 (0)