mapbox / mapbox/mapbox-gl-js

Cannot read properties of undefined (reading 'send')

Open
#12,705 1 comment 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

Hello,

Mapbox is throwing an error if the map is unmounted before it completely loads.

In this [fiddle](https://jsfiddle.net/yh8wt1b2/8/) you can see the error in the browser console.
This is not the only error that is thrown. Sometimes I get this error:
Screenshot 2023-05-09 at 12 16 12

**mapbox-gl-js version**: 2.10.0

**Chrome**:112.0.5615.137

### Steps to Trigger Behavior

1. Open a map
2. Let it load some data, but not all
3. Unmount the map
4. Repeat steps 1-3

### Link to Demonstration

https://jsfiddle.net/yh8wt1b2/8/

### Expected Behavior

Mapbox unmounts the map without any errors.

### Actual Behavior

Mapbox throws an error when the map is unmounted before it completely loads.

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 by reproducing the failure in the linked JSFiddle with mapbox-gl-js 2.10.0, following the open, partial-load, unmount, and repeat steps. Trace the map unmount lifecycle and related browser-console errors; the work is done when unmounting before loading completes produces no errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
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.