Failing behavior
Marker icon race condition
This models the current Geofield Map marker lifecycle where an
async icon preload can overwrite a marker icon set by a consumer
after geofieldMapInit.
Waiting to run
Event Log
Minimal Reproduction
const marker = new Marker();
// Geofield Map starts this before geofieldMapInit.
const img = new Image();
img.onload = () => {
marker.setIcon('/default-open-pin.png');
};
img.src = '/default-open-pin.png';
// Site code waits for geofieldMapInit and sets a dynamic icon.
document.addEventListener('geofieldMapInit', () => {
marker.setIcon('/closed-pin.png');
});