mapbox / mapbox/mapbox-gl-directions

Regression in 4.3.1: this.directions.setDestination and this.directions.setOrigin no longer populate sources.directions

Open
#321 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug
Dominant language
JavaScript
Stars
255
Forks
130
PR merge metrics
No merged PRs in 30d

Description

In version 4.2.0, calling the following:

```javascript
this.directions.setDestination(this.destinationLocation);
this.directions.setOrigin([e.coords.longitude, e.coords.latitude]);

console.log(this.directions);
console.log(this.map.getStyle().sources.directions.data);
```

Correctly populates `sources.directions` with two features.

However, after upgrading to 4.3.1, this behavior has changed. The same calls no longer populate `sources.directions` as expected.

### Expected Behavior:
- After setting the destination and origin, the `sources.directions` should contain two features.

### Actual Behavior:
- In 4.3.1, `sources.directions` remains empty or does not populate as it did in 4.2.0.

### Steps to Reproduce:
1. Initialize directions and map in 4.3.1.
2. Set destination using `this.directions.setDestination`.
3. Set origin using `this.directions.setOrigin`.
4. Check the contents of `sources.directions` using `console.log(this.map.getStyle().sources.directions.data)`.

### Workaround:
Provide any workaround you've found, or indicate none if not available.

### Environment:
- Version: 4.3.1
- Browser/Device: [Add details]

Could you investigate the change between versions and provide guidance on the correct way to populate `sources.directions` in 4.3.1?

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

Compare the 4.2.0 and 4.3.1 implementations around directions.setDestination and directions.setOrigin, then inspect the map.getStyle().sources.directions.data result in a minimal reproduction. Done means identifying the regression or changed contract and documenting the correct way to obtain or populate the two expected features in 4.3.1.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.