mapbox / mapbox/mapbox-gl-draw

UncombineFeatures does not copy the feature properties

Open Beginner friendly
#1,080 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug
Dominant language
JavaScript
Stars
1.1k
Forks
612
Avg merge
8d 9h
Merged PRs (30d)
5

Description

When a MultiFeature is uncombined into its sub-features, each one is given the exact properties object of the multifeature, rather than a copy. The implication of this is that when `setFeatureProperty` is called with the id of one of the sub-features, the properties of all sub-features will affected, even though they all have different ids.

The line responsible for the problem:
https://github.com/mapbox/mapbox-gl-draw/blob/0efdb4d14a0ecae37cfe467334aaa5b2e501f702/src/modes/simple_select.js#L364

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

Inspect the linked line in src/modes/simple_select.js and trace how UncombineFeatures assigns properties to each sub-feature. Reproduce the case by calling setFeatureProperty on one sub-feature, then verify that changing it no longer affects the others; add or update coverage if the repository’s existing tests cover this behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.