mapbox-gl-js icon indicating copy to clipboard operation
mapbox-gl-js copied to clipboard

Config expression not evaluated in filter

Open 5andr0 opened this issue 1 month ago • 0 comments

mapbox-gl-js version: v3.3.0

browser: irrelevant

Steps to Trigger Behavior

Add config schema to map style

"schema": {
          "test": {"default": true},
        },

Using 'filter': ['!', ['config', 'test', 'basemap']] config.js#L81 evaluate() is never called and always returns false, even when the config is set to true.

Workaround: config expression inside style properties is evaluated properly (when created with createPropertyExpression ) 'visibility': ['case', ['config', 'test', 'basemap'], 'none', 'visible']

IMHO the filter has to be updated anyway. Right now we can't use the new expression syntax when using the old deprecated filter keywords like == or in and so on. Maybe add an addLayer option to make it a data driven expression with new syntax only, which supports config or just completely ditch support for the deprecated syntax.
If you really want to keep support for the old syntax, maybe add an indicator for using the new syntax with filter: ['v2', [...]]

5andr0 avatar May 20 '24 08:05 5andr0