Switching away from the map while it is loading causes a `t.getActor() is undefined` error that cannot be caught before it has been logged to the console
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
**mapbox-gl-js version**: 1.6.1
**browser**: Firefox 120.0 (64-bit)
### Steps to Trigger Behavior
1. Have two pages, one where the map is loaded
2. Switch to the other page when the map object has been created but before it starts rendering any tiles
3. You will then see various "Uncaught TypeError: t.getActor() is undefined" console errors
### Expected Behavior
Have a way to stop this from happening.
### Actual Behavior
I cannot stop this error from being output to the terminal.
- I've tried wrapping the `new mapboxgl.Map` call in a try catch but that does not get triggered likely because the problematic `cacheEntryPossiblyAdded mapbox-gl.js:29` call is actually a callback.
- Same with defining a `map.on('error'` right after the map creation, the error doesn't seem to go through that flow for some reason.
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
Reproduce the issue by switching pages after the map object is created but before tiles render, then inspect the cacheEntryPossiblyAdded callback around mapbox-gl.js line 29. Check how this asynchronous error relates to new mapboxgl.Map and map.on('error'); done means the page switch no longer logs an uncaught t.getActor() error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100