-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Fix fallback conditional for filter validation #11475
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a test for this so that this doesn't regress again after a potential refactoring of validation code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Just one thought: your changes to validate_filter.js
are going to trigger a merge conflict with #11529, which also makes a change addressing the readability of that line. So perhaps consider reverting that change to simplify merging?
@@ -13,7 +13,7 @@ export default function validateFilter(options) { | |||
return validateExpression(extend({}, options, { | |||
expressionContext: 'filter', | |||
// We default to a layerType of `fill` because that points to a non-dynamic filter definition within the style-spec. | |||
valueSpec: options.styleSpec[`filter_${layerType || 'fill'}`] | |||
valueSpec: options.styleSpec[`filter_${layerType}`] || options.styleSpec[`filter_fill`] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice improvement to readability! But I think that this change will have a conflict with the different approach @stepankuzmin is taking here.
Maybe consider reverting this to skip resolving the merge conflict?
valueSpec: options.styleSpec[`filter_${layerType}`] || options.styleSpec[`filter_fill`] | |
valueSpec: options.styleSpec[`filter_${layerType || 'fill'}`] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing that out @SnailBones I reverted this change
Launch Checklist
filter_${layerType}
is undefinedmapbox-gl-js
changelog:<changelog>Fix a bug that prevented some filters from being validated properly</changelog>