mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-18 21:16:47 +00:00
fix(maps): the projection, the labels and two unbounded reads
A map keeps the datum it was built with, and Leaflet cannot change one afterwards. The basemap could still turn into Amap's after the fact: a first settings request that fails leaves the store on defaults for the session and is healed later, and the raster layer then drew GCJ-02 tiles under a map still projecting WGS-84, putting every marker, route and cluster a few hundred metres off the street beneath it until the planner was left and reopened. The datum is part of the element's identity now, so a flip rebuilds the map. Only the datum: keying on the whole tile URL would throw the view away on every template edit. Index POIs were labelled by an exact lookup of a term the index matches as a substring, so any leaf that is not literally a term missed and took the first category of the request instead. In a corridor search that is whichever pill was tapped first, and the panel groups and colours on that field: a trattoria came back as a petrol station, or a petrol station as tonight's hotel. The label now comes from the term that actually matched, longest first. Two outbound reads were missing what the house rule asks for. The brand-logo fetch had no deadline at all next to a Wikidata hop that allows six seconds, so a stalled CDN held a request context and a socket for undici's five-minute default, and its size cap only applied after the bytes were in memory. The Wikimedia photo proxy beside it had the same shape. And the Amap provider buffered every answer uncapped and trusted a cast for its arrays, so a `pois` object rather than a list threw a TypeError that surfaced as a 500 instead of the OpenStreetMap answer.
This commit is contained in:
@@ -1006,6 +1006,15 @@ export const MapView = memo(function MapView({
|
||||
<>
|
||||
<div className="w-full h-full relative">
|
||||
<MapContainer
|
||||
// The datum is in the element's identity, because react-leaflet builds the
|
||||
// map once and Leaflet cannot change a CRS afterwards. Settings can arrive
|
||||
// late — a first GET that fails leaves the store on defaults until
|
||||
// ensureSettingsLoaded heals it — and without this the raster layer would
|
||||
// switch to Amap's GCJ-02 tiles under a map still projecting WGS-84, which
|
||||
// puts every marker and route a few hundred metres off the street beneath
|
||||
// it. Only the datum: keying on the whole tile URL would throw the view and
|
||||
// the cluster group away on every template or API-key edit.
|
||||
key={isGcjBasemap ? 'gcj02' : 'wgs84'}
|
||||
id="trek-map"
|
||||
center={initialView.center}
|
||||
zoom={initialView.zoom}
|
||||
|
||||
Reference in New Issue
Block a user