diff --git a/client/src/components/Map/MapView.tsx b/client/src/components/Map/MapView.tsx
index 585ce36f7..ddae9a2f7 100644
--- a/client/src/components/Map/MapView.tsx
+++ b/client/src/components/Map/MapView.tsx
@@ -170,14 +170,15 @@ function createPoiIcon(category: string, brandWikidata?: string | null) {
const cat = POI_CATEGORY_BY_KEY[category]
const color = cat?.color || '#6b7280'
const svg = cat ? renderIconMarkup(createElement(cat.Icon, { size: 13, color: 'white', strokeWidth: 2.5 })) : ''
- // onerror empties the wrapper: the route answers 204 for a brand Wikidata has no
- // logo for, and an empty circle in the category colour is the right fallback.
- const inner = brand
- ? `
`
- : svg
+ // The logo lies over the category pin and only becomes visible once it has loaded, so
+ // a brand Wikidata has no logo for (the route answers 204), a failed request and one
+ // still in flight all leave the pin exactly as it would be without a brand.
+ const logo = brand
+ ? `
`
+ : ''
const icon = L.divIcon({
className: '',
- html: `
${inner}
`,
+ html: `${svg}${logo}
`,
iconSize: [26, 26],
iconAnchor: [13, 13],
tooltipAnchor: [0, -14],
diff --git a/client/src/components/Map/MapViewGL.test.tsx b/client/src/components/Map/MapViewGL.test.tsx
index 81bf73d64..e0022f6eb 100644
--- a/client/src/components/Map/MapViewGL.test.tsx
+++ b/client/src/components/Map/MapViewGL.test.tsx
@@ -1855,4 +1855,33 @@ describe('MapViewGL', () => {
expect(glMap.off).toHaveBeenCalledWith('moveend', expect.any(Function))
expect(glMap.off).toHaveBeenCalledWith('zoomend', expect.any(Function))
})
+
+ it('FE-COMP-MAPVIEWGL-071: POI suggestions ride the map render clock instead of the pointer', async () => {
+ // Same drift the planned-place pins had: a library Marker repositions on every
+ // `move` event — one per pointer sample — while the canvas draws once a frame, so
+ // the suggestions swam over the map during a drag and snapped back on release.
+ loadOnAttach()
+ glCanvasContainer.replaceChildren()
+ glMap.project.mockReturnValue({ x: 100, y: 80 })
+
+ render(
+ ,
+ )
+ await flushFrames()
+
+ const layer = glCanvasContainer.firstElementChild as HTMLElement
+ expect(layer.children.length).toBe(1)
+ const pin = layer.firstElementChild as HTMLElement
+ expect(pin.style.transform).toContain('translate(100px, 80px)')
+
+ glMap.project.mockReturnValue({ x: 140, y: 60 })
+ act(() => { mapHandler('render')() })
+
+ expect(pin.style.transform).toContain('translate(140px, 60px)')
+ })
})
diff --git a/client/src/components/Map/MapViewGL.tsx b/client/src/components/Map/MapViewGL.tsx
index 077aa6c2a..847eb5c28 100644
--- a/client/src/components/Map/MapViewGL.tsx
+++ b/client/src/components/Map/MapViewGL.tsx
@@ -356,6 +356,20 @@ function makePlacePin(map: any, layer: HTMLElement, el: HTMLElement, lng: number
}
}
+/**
+ * Puts an element on the map as a pin.
+ *
+ * `layer` is only ever set under MapLibre (that is where it gets created), so passing it
+ * along is the whole provider decision: with a layer we position the element ourselves on
+ * the map's render clock, without one the library's own Marker does it.
+ */
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+function attachPin(map: any, gl: any, layer: HTMLElement | null, el: HTMLElement, lng: number, lat: number): PlacePin {
+ return layer
+ ? makePlacePin(map, layer, el, lng, lat)
+ : libraryPin(new gl.Marker({ element: el, anchor: 'center' }).setLngLat([lng, lat]).addTo(map))
+}
+
// Tone dot for a plugin marker — visual twin of MapPluginMarkers' divIcon.
function createPluginMarkerElement(tone: PluginMapMarker['tone']): HTMLDivElement {
const color = PLUGIN_TONE_COLORS[tone] ?? PLUGIN_TONE_COLORS.default
@@ -404,22 +418,21 @@ function createPoiMarkerElement(category: string, brandWikidata?: string | null)
const svg = cat ? renderIconMarkup(createElement(cat.Icon, { size: 13, color: 'white', strokeWidth: 2.5 })) : ''
const el = document.createElement('div')
el.style.cssText = 'width:26px;height:26px;cursor:pointer;will-change:transform;'
- const inner = brandLogoMarkup(brandWikidata) || svg
- const background = brandWikidata ? '#fff' : color
- el.innerHTML = `${inner}
`
+ el.innerHTML = `${svg}${brandLogoMarkup(brandWikidata)}
`
return el
}
/**
- * The
for a brand logo, or '' when there is no brand.
+ * The
for a brand logo, laid over the category pin, or '' when there is no brand.
*
- * `onerror` empties the wrapper rather than leaving a broken-image glyph: the route
- * answers 204 for a brand Wikidata has no logo for, and an empty circle in the
- * category colour is the right fallback.
+ * It starts invisible and is only shown once it has loaded, so the pin underneath stays
+ * exactly as it would be without a brand until there is really something to show. That
+ * covers all three ways this can go: a brand Wikidata has no logo for (the route answers
+ * 204), a request that fails, and one that simply has not arrived yet.
*/
-function brandLogoMarkup(brandWikidata?: string | null): string {
+export function brandLogoMarkup(brandWikidata?: string | null): string {
if (!brandWikidata || !/^Q[1-9][0-9]{0,11}$/.test(brandWikidata)) return ''
- return `
`
+ return `
`
}
export function MapViewGL({
@@ -497,25 +510,27 @@ export function MapViewGL({
const markersRef = useRef