Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash - TypeError: i.map is not a function #935

Open
pathmapper opened this issue Sep 10, 2024 · 8 comments · May be fixed by #944
Open

Crash - TypeError: i.map is not a function #935

pathmapper opened this issue Sep 10, 2024 · 8 comments · May be fixed by #944

Comments

@pathmapper
Copy link
Contributor

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 Fail to parse layout text-field with expression qgis/QGIS#58364)
  2. Click on the following layer
@HarelM
Copy link
Collaborator

HarelM commented Sep 10, 2024

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

@pathmapper
Copy link
Contributor Author

smaller style?

sure -> gris_one_layer.json

@pathmapper
Copy link
Contributor Author

shorter -> gris_one_layer_shorter.json

@pathmapper
Copy link
Contributor Author

Request for https://data.geopf.fr/annexes/ressources/vectorTiles/fonts.json returns a 404 / html page.

image

@nicogodet
Copy link

@HarelM
Copy link
Collaborator

HarelM commented Sep 11, 2024

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...

@pathmapper
Copy link
Contributor Author

@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

@HarelM HarelM linked a pull request Sep 29, 2024 that will close this issue
5 tasks
@HarelM
Copy link
Collaborator

HarelM commented Sep 29, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants