Description
Beginning with 0.45.0, having a "." in a layer's ID crashes the web workers. I originally thought this was the same as #6648, but it isn't:
From this comment:
I'm experiencing this too. On upgrading to
0.45.0
from0.45.2
I get several errors in the console in Chrome (I suspect one for each worker):this.parent.getWorkerSource(...)[a[2]] is not a function at Ma.receive (blob:http://localhost:3000/c3408085-1173-4234-bfef-47ecdda464e3:1)
Mapbox is imported with
import mapboxgl from "mapbox-gl";
and pulls in the minified/dist/mapbox-gl.js
. I've also tried importingmapbox-gl/dist/mapbox-gl-dev.js
, which has the same effect. The problem line appears to be this line.
From this comment:
Ah, ok, so the problem is the
const keys = data.type.split('.');
As of0.45.0
it has become illegal to use a period character in your source/layer names. This is definitely a bug, as this is a pattern we use pretty extensively.Mapbox should probably escape periods (and any other special characters) before serializing, and then unescape them when deserializing.
EDIT: looking at the
git blame
, it appears that this has been in place for a while... perhaps something else has caused it to become problematic just now?EDIT2: Ok, so it looks like the bug was likely introduced in 373f5c4
mapbox-gl-js version: 0.45.0
browser: Chrome 66.0.3359.170
Steps to Trigger Behavior
- upgrade to 0.45.0
- add layers with a period in the name (ex: "mygroup.mylayer")
- run it
Expected Behavior
Actual Behavior
Uncaught TypeError: this.parent.getWorkerSource(...)[a[2]] is not a function
EDIT: I had switched the "Actual" and "Expected" links above. 🤦🏻♂️