Skip to content

setPaintProperty will request tiles again #13575

@enersis-pst

Description

@enersis-pst

mapbox-gl-js version

v3.8.0

Browser and version

141.0.7390.65

Expected behavior

Tiles are not requested again when running setPaintProperty

Actual behavior

Tiles are requested again when running setPaintProperty

Link to the demonstration

No response

Steps to trigger the unexpected behavior

When i run setPaintProperty on our vector tiles (running on our own tileservice, created with tippicanou) than it request some tiles again.

its happen for example when i switch between this two styles.

map.setPaintProperty("cableLayer", "line-color", "red")
map.setPaintProperty("cableLayer", "line-color", [

        "case",
        [
            "==",
                [
                    "get",
                    "type"
                ]
            ,
            "5"
        ],
        "#686868",
        "#686768"
    ]
)

but not when i run the same style again or this, without get

map.setPaintProperty("cableLayer", "line-color", [

        "case",
        [
            "==",
                [
                    "string", //<==========
                    "type"
                ]
            ,
            "5"
        ],
        "#686868",
        "#686768"
    ]
)

so i beleave its happend because of the get expression.

i tested it also on the default mapbox style but woudnt get this behaviour.

this is the source config

{
    "type": "vector",
    "promoteId": {
        "cable": "id"
    },
    "tiles": [
        "https://xxxxx.com/{z}/{x}/{y}?regionId=yyyyy&scenarioId=defaultScenario&year=2025"
    ],
    "bounds": [
        6.005877,
        51.617003,
        6.229508,
        51.791297
    ],
    "minzoom": 10,
    "maxzoom": 18
}

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions