[openstreetmap/openstreetmap-website] Can’t switch to Transport Map: TypeError: e is undefined in getMapBaseLayerId (#2215)

hfs notifications at github.com
Wed Apr 24 09:55:24 UTC 2019


When I open https://www.openstreetmap.org/ and try to switch to the Transport Map in the Map Layers menu, I would expect the map style to change to the transport style and the new map tiles to load. Instead, the map area becomes just grey and no map is displayed. This seems to be somewhat random, i.e. it happens in about 50 % of cases when trying to switch the map style. Clicking the same map style again usually fixes it and takes me to the desired map.

This error is logged in the console:

```
TypeError: e is undefined application-599745f20aed1b16d8ce60962f4b3458793d7d0649ba3eb1139998ecbdb83231.js:formatted:11438
    getMapBaseLayerId application-599745f20aed1b16d8ce60962f4b3458793d7d0649ba3eb1139998ecbdb83231.js:11438
    l index-8de4fda0f10c81f0db6593a86cdcf3e1310c83de0153758674c137b4d75f0cbb.js:1
    fire application-599745f20aed1b16d8ce60962f4b3458793d7d0649ba3eb1139998ecbdb83231.js:5949
    removeLayer application-599745f20aed1b16d8ce60962f4b3458793d7d0649ba3eb1139998ecbdb83231.js:8029
    onAdd index-8de4fda0f10c81f0db6593a86cdcf3e1310c83de0153758674c137b4d75f0cbb.js:1
    forEach (index):262
    onAdd index-8de4fda0f10c81f0db6593a86cdcf3e1310c83de0153758674c137b4d75f0cbb.js:1
    dispatch application-599745f20aed1b16d8ce60962f4b3458793d7d0649ba3eb1139998ecbdb83231.js:2358
    handle application-599745f20aed1b16d8ce60962f4b3458793d7d0649ba3eb1139998ecbdb83231.js:2295
```

The code in question is this:

```javascript
      getMapBaseLayerId: function () {
        var e;
        return this.eachLayer(function (t) {
>>>>      t.options && t.options.keyid && (e = t)
        }),
        e.options.keyid
      },
```

When the error happens `options` is an empty object and `options.keyid` is undefined.

![osm_getMapBaseLayerId](https://user-images.githubusercontent.com/538109/56650606-aa94b000-6687-11e9-8d5e-ecdf10ec6f4b.png)

My browser is Firefox 66.0.2 on Linux.


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/2215
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20190424/7affae81/attachment.html>


More information about the rails-dev mailing list