mapbox / mapbox/mapbox-gl-directions

Error when using custom styles and removeControl method

Open
#167 1 comment 0 reactions 0 assignees View on GitHub
auto-triaged bug
Dominant language
JavaScript
Stars
255
Forks
130
PR merge metrics
No merged PRs in 30d

Description

I'm getting the error: `Uncaught TypeError: Cannot read property 'recalculate' of undefined` after I use the map.removeControl method on the directions control. Also, it's only happening when using custom styles.

Here's a JSFiddle showing the issue: https://jsfiddle.net/bryantaxs/uomq0zvz/

Any thoughts on this one?

Contributor guide

Open the contributing guide

Research direction

Start by running the linked JSFiddle and reproducing the error after calling map.removeControl on the directions control with custom styles. Trace the resulting `recalculate` access and verify that removing the control no longer throws the reported TypeError in that configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.