maplibre/maputnik

Crash - TypeError: i.map is not a function

pathmapper opened this issue · 8 comments

Maputnik version: current https://maplibre.org/maputnik/
Browser: Chrome/Firefox
OS: Linux

Description of the bug:

Maputnik crashes when selecting a layer (maybe related to not available fonts).

image

Steps to reproduce the behavior:

  1. Load style gris.json (from qgis/QGIS#58364)
  2. Click on the following layer

Can you try and reproduce this with a smaller style? The current provided style is a bit long to narrow down the issue...

smaller style?

sure -> gris_one_layer.json

Can you try and refresh the page?
I was able to reproduce it, but I think I refreshed the page and I can no longer reproduce it...?
I've looked at the code, and it doesn't look like this should happen as the code is doing fonts?.map which should not run map on an undefined object...

@HarelM thanks for looking into this. With Chrome / Chromium there's still the initial crash and no crash anymore after the refresh, but with Firerfox it keeps crashing all the time after a refresh.

@nicogodet -> Geoplateforme/geoplateforme.github.io#56

I think the following should fix this issue:

A better usage of promises instead of callbacks would have greatly improved the readability of the code...

The root cause is indeed the fact that font.json does not exists on the server and that the server is returning 404.