visgl / visgl/react-map-gl

[Feat] Force `fresh=true` on fetched styles

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

Nobody has claimed this yet.

feature
Dominant language
TypeScript
Stars
8.5k
Forks
1.4k
Avg merge
5d 17h
Merged PRs (30d)
3

Description

Target Use Case

When using a Mapbox Style URL like mapStyle="mapbox://styles/foo/123" the results are cached.

I am looking for a way to force a fresh version of the styles.

The Mapbox Style API has the (undocumented) fresh=true param for this use case (see https://github.com/mapbox/mapbox-sdk-js/issues/364#issuecomment-617894314).

However, I don't see any way to pass this to mapbox-gl or maplibre-gl.

I tried manually fetching the same style URL that I see being fetched from the console and appending ?fresh=true, but it looked like that was not picket up by the map. Maybe because I change the URL when adding the flag?

Proposal

Ideally, I would be able to call <Map mapStyle="" fresh={true} /> (with true being evaluated by some condition (like a debug flag) internally).

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

Start by tracing how the Map component handles the mapStyle prop and fetches Mapbox styles. Check the existing tests around style loading, then verify that a fresh option causes the requested style URL to use fresh=true without breaking normal style loading.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
data-visualization, frontend
Issue type
Feature
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.