Skip to content

"visible" attribute is misleading and could be deprecated #1245

@mangecoeur

Description

@mangecoeur

The "visible" attribute of Layers gives users the idea that there is a "visible" toggle in Leaflet that allows them to load data into the browser and toggle visibility on and off.

But this is not the case, instead some (but not all) layers special case the visible attribute and don't add the layer data to leaflet if it's false. This means that users are sending data to the browser that then gets discarded, rather than "efficiently" preparing layers in the browser and just toggling their rendering. Furthermore, some layers just don't implement this case leading to confusion (e.g. #1244 ), and toggling the visible attribute on an already created layer doesn't always work.

The simplest solution would be to document+deprecate the visible attr - because (at least at a glance) Leaflet doesn't support visibility toggling at all, only adding or not the data to the map.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions