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

Parse conditionals more reliably #30

Open
aparlato opened this issue May 13, 2022 · 1 comment
Open

Parse conditionals more reliably #30

aparlato opened this issue May 13, 2022 · 1 comment
Assignees

Comments

@aparlato
Copy link
Contributor

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 of match and case 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. For match 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.

@mulloverit
Copy link

Acceptance criteria

  • A user that has a complex style can have it parsed fully.
  • This has a big impact for a small number of users.
  • Also has a tech debt aspect, where user story is less relevant

@aparlato aparlato self-assigned this Jan 6, 2023
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

2 participants