Cannot read properties of undefined (reading 'send')
Nobody has claimed this yet.
- 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:
**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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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