mapbox / mapbox/mapbox-gl-draw

Calling getSelectedPoints in draw.update handler causes a crash

Open
#1,353 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

I've forked the default demo sandbox here: https://codesandbox.io/p/sandbox/wp488f

Preview link here: https://mr93f6.csb.app/

All I've done is added `console.log(draw.getSelectedPoints());` to the `updateArea` function.

## Steps to reproduce:

1. Draw a polygon
2. Select a point
3. Trash the point, page crashes

Note that it doesn't always crash, so keep trying. It'll happen eventually.

### Screenshot of sandbox page crash

Image

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 linked CodeSandbox and the updateArea handler, where draw.getSelectedPoints() was added. Reproduce the crash by drawing a polygon, selecting a point, and trashing it, repeating as needed because the failure is intermittent. Done means the handler no longer crashes during this sequence and the selected-points behavior remains usable.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.