mapbox / mapbox/mapbox-gl-js

updateData throws exception when called on source with dynamic=true and cluster=true

Open
#13,245 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug :lady_beetle:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

Hi,

I am trying to use updateData on a GeoJSON source that has both dynamic=true and cluster=true.
An exception is throw, and I cannot use updateData.

mapbox-gl-js version: 3.5.2

browser: chrome 127.0.6533.74

Steps to Trigger Behavior
  1. Create a GeoJSON source with dynamic=true AND cluster=true
  2. Once the map is loaded, try adding a feature to the source map using updateData
Link to Demonstration

https://stackblitz.com/edit/mapbox-cluster-and-dynamic-bug?file=main.js

  • See errors in the console when clicking the 'Add Location' button
  • Set cluster=false, and 'Add Location' will add points around (0,0) on the map.
Expected Behavior

I should be allowed to call updateData on a source that has both cluster=true and dynamic=true, or at least an exception that makes sense if setting both flags simultaneously isn't allowed.

Actual Behavior
Exception has occurred: TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
  at $.load (blob:...)
    at blob:...
    at _e.loadGeoJSON (blob:...)
    at _e.loadData (blob:...)
    at av.processTask (blob:...)
    at n2.scheduler.add.t3.metadata.type (blob:...)
    at sv.add (blob:...)
    at av.receive (blob:...)

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 main.js reproduction in the linked StackBlitz project and run it with mapbox-gl-js 3.5.2. Trace the updateData call after the map loads when the GeoJSON source uses both dynamic=true and cluster=true. Done means adding a point no longer throws the reported TypeError, or the API reports a clear error for the unsupported combination.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.