mapbox / mapbox/mapbox-gl-js

marker addTo ->ERROR TypeError: this._offset.mult is not a function

Open
#13,145 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs information :pray:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

For a line of code that worked in version 2.* which is attempting to add a Marker to the map using addTo
"this.queryMarker.addTo(this.map.ui);"
where this.queryMarker is a Marker
and this.map.ui is a mapbox-gl Map instance

I am getting an error:
ERROR TypeError: this._offset.mult is not a function
at aI._updateDOM (mapbox-gl.js:33:808684)
at mapbox-gl.js:33:810271
at Map._requestDomTask (mapbox-gl.js:33:843059)
at aI._update (mapbox-gl.js:33:810216)
at aI.addTo (mapbox-gl.js:33:805410)

**mapbox-gl-js version**:
3.*
2.14.0
Seems to happen after version 2.7.0 where the addTo command worked.
**browser**:
Chrome

### Steps to Trigger Behavior
I have not confirmed the error in a simpler setup, but the line of code shared above has worked for a couple years and suddenly isn't.

### Link to Demonstration
not presently possible
I appreciate the virtue of having a discrete test setup.
However, the offending code exists once and should be easy for an IDE to find, just look for this._offset._mult
"_updateDOM(){const e=this._pos;if(!e||!this._map)return;const t=this._offset.mult(this._scale); ..."

What reasons would this._offset be null/undefined? or not have the expected mult function?

### Expected Behavior
I expect a marker to be added to the map without error
### Actual Behavior
I get an error about this._mult not being a function.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported `this.queryMarker.addTo(this.map.ui)` call and the `_updateDOM` stack trace in mapbox-gl.js, then inspect how the marker’s `_offset` is initialized before `_offset.mult` is called. Reproduce the failure across the reported 2.7.0, 2.14.0, and 3.* versions if possible. Done means identifying the cause and confirming that adding the marker completes without the TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.