Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config expression not evaluated in filter #13180

Open
5andr0 opened this issue May 20, 2024 · 0 comments
Open

Config expression not evaluated in filter #13180

5andr0 opened this issue May 20, 2024 · 0 comments

Comments

@5andr0
Copy link

5andr0 commented May 20, 2024

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', [...]]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant