Mapbox GL JS v2.x tile cache persistence across token migration
0 reputation · 17 Jul 2025, 14:51 UTC
Mapbox GL JS v2.x tile cache persistence across token migration
Goal
Configure a mapbox-gl-js application to maintain seamless tile availability during access token migration without visible loading gaps or tile reloads for users currently viewing the map.
Constraints
- Application uses mapbox-gl-js version 2.x with existing tilecache directory configuration
- Users may have active map views with partially loaded tiles when migration occurs
- Token validation occurs at initialization, failing with 'Invalid access token' if missing
- Browser storage quotas limit offline cache size and may evict older tiles
Uncertainty
The tilecache directory persists tiles locally, but it is unclear whether cached tiles remain accessible when a new access token is configured without clearing the cache directory. Mapbox CDN serves tiles with eventual consistency, meaning brief visual inconsistencies can occur during active tile updates. The mapbox-gl-offline plugin supports offline caching, but its interaction with token changes during active sessions requires verification.