[Bug] terrain prop does not reset to no-terrain when set to undefined
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 8.5k
- Forks
- 1.4k
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 3
Description
Description
Once terrain is enabled by something like terrain={source: 'terrain-dem', exaggeration: 1.5}; you can not disable it again by setting it to undefined. Setting is to null does work but throws a typescript error.
Expected Behavior
Typescript says terrain is terrain | undefined, so setting to undefined should disable terrain in maplibre.
Steps to Reproduce
Toggle terrain setting between terrain and undefined.
Environment
- Framework version: 4.7.1 or 5.1.0
- Browser: Chrome
- OS: Mac
Logs
No response
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
Search the terrain prop update path and existing terrain-related tests or map component entry points. Reproduce the transition from a terrain value to undefined, then add coverage showing that the terrain setting is disabled without a TypeScript error; the issue is done when that regression passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100