visgl / visgl/react-map-gl

[Bug] terrain prop does not reset to no-terrain when set to undefined

Open
#2,490 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.