[openstreetmap/openstreetmap-website] OMT layer preview doesn't update (Issue #6219)

Grant notifications at github.com
Tue Jul 22 21:09:35 UTC 2025


Firefishy left a comment (openstreetmap/openstreetmap-website#6219)

Likely related to the exception being thrown when opening the Map Layers panel:

```
application-996133772a2ed2520ff9c51f898158e3039aaebd4c5398cf52d6d905bc7744b2.js:32096 Uncaught TypeError: Cannot read properties of undefined (reading 'find')
    at NewClass.onAdd (application-996133772a2ed2520ff9c51f898158e3039aaebd4c5398cf52d6d905bc7744b2.js:32096:50)
    at NewClass._layerAdd (application-996133772a2ed2520ff9c51f898158e3039aaebd4c5398cf52d6d905bc7744b2.js:23670:10)
    at NewClass.fire (application-996133772a2ed2520ff9c51f898158e3039aaebd4c5398cf52d6d905bc7744b2.js:17379:11)
    at NewClass._resetView (application-996133772a2ed2520ff9c51f898158e3039aaebd4c5398cf52d6d905bc7744b2.js:21084:11)
    at NewClass.setView (application-996133772a2ed2520ff9c51f898158e3039aaebd4c5398cf52d6d905bc7744b2.js:20092:10)
    at setView (index-0f15772a813d980151039882284d8f66967c8c119f39a76b316bcfdca91b7652.js:1489:19)
    at HTMLDivElement.shown (index-0f15772a813d980151039882284d8f66967c8c119f39a76b316bcfdca91b7652.js:1476:11)
    at HTMLDivElement.dispatch (application-996133772a2ed2520ff9c51f898158e3039aaebd4c5398cf52d6d905bc7744b2.js:5135:27)
    at HTMLDivElement.<anonymous> (application-996133772a2ed2520ff9c51f898158e3039aaebd4c5398cf52d6d905bc7744b2.js:4939:28)
    at Object.trigger (application-996133772a2ed2520ff9c51f898158e3039aaebd4c5398cf52d6d905bc7744b2.js:8619:12)
```

The issue is: `const matchedLanguage = supportedLanguages.find(`

```
 onAdd: function (map) {
    L.MaplibreGL.prototype.onAdd.call(this, map);
    const maplibreMap = this.getMaplibreMap();
    const supportedLanguages = maplibregl.Map.prototype.supportedLanguages;
    for (const preferredLanguage of OSM.preferred_languages) {
      const normalizedPreferredLanguage = preferredLanguage
        .toLowerCase()
        .replace("-", "_");
      const matchedLanguage = supportedLanguages.find(
        (supported) => supported.toLowerCase() === normalizedPreferredLanguage
      );
      if (matchedLanguage) {
        maplibreMap.setLanguage(matchedLanguage);
        break;
      }
    }
```


-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/6219#issuecomment-3104839819
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/issues/6219/3104839819 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250722/24489a97/attachment.htm>


More information about the rails-dev mailing list