Skip to content

Cannot access map style if source fails to load #583

@jpayne79

Description

@jpayne79

Environment

  • Android OS version:
  • Devices affected:
  • Maps SDK Version: 10.0.0-r.6

Observed behavior and steps to reproduce

When adding a new source to the map style, if the source fails to load, map.getStyle will return null since the internal check to style.isStyleLoaded is false. This seems problematic as it would be ideal if we could access the style object to remove the problematic source.

Steps to repro:

  • Get MapboxMap and load a default style
  • Once the style is loaded, add a source (vector/raster) that will return a 400/500
  • map.getStyle is now null since the style isn't fully loaded due to the source error.

Expected behavior

Preferably we'd be able to access map.style regardless of whether it's fully loaded or not as callers can check it themselves. The only other workaround that is apparent to me would be to store a reference to the style after the initial load. However, I'd prefer to leave the style reference management to MapboxMap and only access it through the map object instead of having to store a reference on our side.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🪲Something isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions