fix: the map falls back to raster where the vector style cannot load, the tour layer pill fits narrow maps and stands on the side in 3D, the dashboard's widget column scrolls on its own, and the CI checks the watch sync and journey write-up broke

This commit is contained in:
Maurice
2026-11-08 12:05:59 +01:00
parent cb41f08199
commit c7f144d3ff
21 changed files with 334 additions and 44 deletions
@@ -107,6 +107,26 @@ function attachGlLayer(map: L.Map, layer: GlLeafletLayer, style: string): boolea
return true
}
/**
* Calls `fail` once when the layer's style errors before it ever loaded. Errors
* after that (a tile here and there) are the map's ordinary weather and leave it be.
*/
function onStyleFailure(layer: GlLeafletLayer, fail: () => void): void {
const gl = layer.getMaplibreMap?.()
if (!gl) return
let loaded = false
gl.once('style.load', () => {
loaded = true
})
const onError = (event: { error?: unknown }) => {
if (loaded) return
gl.off('error', onError)
console.warn('[basemap] the vector style did not load, drawing raster tiles', event.error)
fail()
}
gl.on('error', onError)
}
/**
* The raster stand-in, attached imperatively for the maps that build Leaflet
* themselves. The react-leaflet callers get the same tiles through the <TileLayer>
@@ -201,6 +221,14 @@ export function VectorBasemap({ style }: { style: string }) {
return
}
layerRef.current = layer
// A style that never loads (its server, or the iOS app's offline protocol
// failing) would leave the map white under its markers: raster instead.
onStyleFailure(layer, () => {
if (cancelled || layerRef.current !== layer) return
detachBasemapLayer(layer)
layerRef.current = null
setGlUsable(false)
})
})()
return () => {