mapbox-gl-js icon indicating copy to clipboard operation
mapbox-gl-js copied to clipboard

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

Open Stephane-Ag opened this issue 2 years ago • 1 comments

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.

Stephane-Ag avatar Dec 08 '23 19:12 Stephane-Ag

Hi @Stephane-Ag,

Thank you for opening this ticket. Please provide a minimal, complete, verifiable demonstration of the issue to help the maintainers and community understand and address the problem accurately. We recommend using https://jsbin.com/. Please include information about the browser version and operating system used.

stepankuzmin avatar Dec 11 '23 12:12 stepankuzmin