A missing Mapbox token is one console.warn per page, not an error per map

With provider=mapbox explicit and no token, useMapInstance logged 'No Mapbox access token provided' as
console.error once per map (7x on pplr), while the UI already says "Map unavailable". It is now a single
console.warn per page, so production consoles stay at 0 errors (dx-shepherd, TKWARN).
This commit is contained in:
Doxa Maps 2026-09-27 08:12:12 +00:00
parent d1cf9e73ab
commit 02faaab75e

View file

@ -469,7 +469,12 @@ export function useMapInstance({
accessToken = window.MAP_TOKEN
}
if (!accessToken) {
console.error('No Mapbox access token provided. Pass "tk" in profile-config JSON or set window.MAP_TOKEN.')
// ONE warn per page, not an error per map: the UI already says "Map unavailable", and a page with
// several maps logged this 7x as console.error, which breaks the 0-errors bar (dx-shepherd, TKWARN).
if (typeof window !== 'undefined' && !window.__doxaNoTokenWarned) {
window.__doxaNoTokenWarned = true
console.warn('No Mapbox access token provided. Pass "tk" in profile-config JSON or set window.MAP_TOKEN.')
}
return
}
if (!accessToken.startsWith('pk.')) {