getStyle then setStyle broken for raster-dem
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**: tested on 1.1.0, probably since forever
**browser**: Chrome 75.0.3770.100 (Official Build) (64-bit)
### Steps to Trigger Behavior
1. setStyle on a style with raster-dem source
2. getStyle anytime
3. setStyle with serialized style object from getStyle
### Link to Demonstration
https://jsfiddle.net/srmanc/L20ha5um/1/
### Expected Behavior
setStyle should work without error msgs
### Actual Behavior
setStyle breaks because bounds and url are set on source but are undefined. Sometimes tiles is undefined on source as well.
There are actually two issues:
1. Why does setStyle break at all if some undefined properties are set on source (this only happens for raster-dem type).
2. When is it acceptable to call getStyle() to get all the relevant properties on sources - they are set initially so there would be no point in not setting them right away - however, tiles property is missing at the first "styledata" event - please review the jsfiddle example with console.log msgs for more input. We can make this work using delete operator but this seems like a nasty bug.
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
Reproduce the failure using the linked JSFiddle and the setStyle/getStyle sequence with a raster-dem source. Inspect how source properties are serialized and restored, including bounds, url, and tiles, and consider both reported questions; done means a style returned by getStyle can be passed back to setStyle without errors or missing required source data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100