String tokens used outside stop functions aren't migrated to expressions
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
**mapbox-gl-js version**: Latest
**browser**: Chrome
### Steps to Trigger Behavior
1. Create a new style in Studio
2. Replace the text-field of the `poi-label` layer (or any other Streets layer) with a string token `{name}` used in your style.json
2. Upload the style to Studio
3. Open the style and see the `{name}` string token persisting as the text-field for the `poi-labels` layer
[Copiable link](https://api.mapbox.com/styles/v1/kelsey-taylor/cks9eqaai013m17t2x8smuil3.html?fresh=true&title=copy&access_token=pk.eyJ1Ijoia2Vsc2V5LXRheWxvciIsImEiOiJjazJ3ZWl2a2YwZHU2M21xbDJnYXA2Z29tIn0.pnZVgZveufjFh20yW0ZI7g) to style
### Expected Behavior
`{name}` should be converted into `["to-string", ["get", "name"]]` via the expression migrator
### Actual Behavior
per @samanpwbb, string tokens are only migrated if they're not on the root of the style: https://github.com/mapbox/mapbox-gl-js/blob/dc8a6308ce3f072b6d87ff556721d1401b8a1f5b/src/style-spec/function/convert.js#L246-L269 https://github.com/mapbox/mapbox-gl-js/blob/dc8a6308ce3f072b6d87ff556721d1401b8a1f5b/src/style-spec/function/convert.js#L24-L26
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/style-spec/function/convert.js at the referenced lines and trace why string tokens on the style root bypass migration. Add coverage for a root-level {name} token and verify that it becomes ["to-string", ["get", "name"]] through the expression migrator.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100