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

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

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
react, typescript

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.

Description

feature
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).

Dominant language
TypeScript
Stars
8.5k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Getting set up

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.

More from visgl/react-map-gl

All issues in visgl/react-map-gl

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.