There's logic in expandLayers that finds properties and property values within the conditions of match and case expressions. It does this fairly naively right now which means it's fragile.
We should see if we can parse these expressions more reliably. It would be worth diving deeper into the style spec to see if there's functionality there we can pull out, but otherwise, we might expand these functions to account for more scenarios.
See https://github.com/stamen/mapbox-gl-style-design-system/blob/main/src/styles/expandLayers.js#L76-L94 and https://github.com/stamen/mapbox-gl-style-design-system/blob/main/src/styles/expandLayers.js#L131-L137
There's logic in
expandLayers
that finds properties and property values within the conditions ofmatch
andcase
expressions. It does this fairly naively right now which means it's fragile.For
case
, it finds the property through finding a lookup expression, then the property values by filtering down to everything that's not a property and not an expression. Formatch
it's more reliable to find properties, but we have some naive handling to parse through instances where we look at the length of a property (eg[length, [get, ref]]
).We should see if we can parse these expressions more reliably. It would be worth diving deeper into the style spec to see if there's functionality there we can pull out, but otherwise, we might expand these functions to account for more scenarios.