Repository navigation
Handle missing map style when finding fonts - #2125
Conversation
|
This prevents the exception, but could you share a full stack trace and reproduction steps? I couldn’t reproduce the application crash with delayed style responses and page freeze/resume. Calling |
|
I was able to reproduce it reliably. The trigger is a WebGL context loss, In MapLibre 6, Tested on Traccar 6.17.0 (app and server). The relevant code is unchanged on Steps:
Stack trace (minified build, With this change the same steps no longer crash, and after |
|
Thanks, that explains why the earlier test didn’t reproduce it. If WebGL context loss is expected behavior, shouldn’t we make sure the map recovers properly? Does this change also handle data or layer changes that happen while the context is lost? |
|
Thanks, I’ve now reproduced the crash and confirmed your original fix resolves it. Sorry for the confusion—the original change is sufficient for this issue. |
This reverts commit daed6b1.
|
Thanks for checking! I've reverted the MapView change, so the PR is back to |
findFontsdestructuresmap.getStyle(), but MapLibre returnsundefinedfrom
getStyle()while a style is still loading. If a map layer componentre-renders during that window (for example when new data arrives right after
the style is reloaded), the UI crashes with:
I see this regularly on mobile after switching back to the Traccar tab.
This change falls back to the default fonts when the style is not available
yet. Layers are re-created once the map is ready, so the correct fonts are
applied after the style finishes loading.