SourceEXpressionBinder.updatePaintArray this.expression.evaluate is not a function
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
I'm running into this nasty intermittent exception that gets thrown. I can't reliably reproduce it, and I can't even imagine how I'd go about setting up a minimal repro case, but I'm reporting it here so that the next person who hits it at least has something to google for.
mapbox-gl-js version: 2.13.0
browser: Chrome
Steps to Trigger Behavior
It's a pretty complex React app with quite a few layers. When you click on features in a certain layer, it updates the style to highlight the thing you clicked on etc etc. There's also feature-state updating on hover.
Maybe 1 time in 100 when you click, an exception is thrown:
mapbox-gl-dev.js:15439 Uncaught TypeError: this.expression.evaluate is not a function
at SourceExpressionBinder.updatePaintArray (mapbox-gl-dev.js:15439:1)
at ProgramConfiguration.updatePaintArrays (mapbox-gl-dev.js:15714:1)
at ProgramConfigurationSet.updatePaintArrays (mapbox-gl-dev.js:15848:1)
at FillBucket.update (mapbox-gl-dev.js:28111:1)
at Tile.setFeatureState (mapbox-gl-dev.js:40275:1)
at SourceFeatureState.initializeTileState (mapbox-gl-dev.js:40646:1)
at SourceCache._tileLoaded (mapbox-gl-dev.js:42994:1)
at VectorTileSource.done (mapbox-gl-dev.js:50296:1)
at Actor.processTask (mapbox-gl-dev.js:39056:1)
Digging into the code a little bit, updatePaintArray is being called on a thing whose expression is { kind: 'constant, value: { r:0, g:0, b: 0, a: 1}. Which doesn't have an evaluate function, so...exception.
That doesn't really help me know what to do about it though.
This full call stack suggests that the trigger ultimately was a call to removeLayer() but maybe I'm misinterpreting that.
Any thoughts? Ideas? Workarounds? Simply suppressing the exception would be a pretty good outcome.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at SourceExpressionBinder.updatePaintArray and trace the call path through ProgramConfiguration.updatePaintArrays, FillBucket.update, Tile.setFeatureState, and SourceCache._tileLoaded, especially around removeLayer(). A fix is done when feature-state or layer-removal updates no longer call evaluate on the reported constant expression; the payload does not identify a reproducible test or source file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100