Proof of concept
Geofield Map marker icon race condition
Two small demos show the current race and the proposed guarded callback fix. Both are dependency-free simulations of the relevant Geofield Map marker icon lifecycle.
Image.onload callback
overwriting a consumer's post-geofieldMapInit icon.
Proposed fix
Guarded callback demo
Shows the module-side guard that skips the default icon when the
marker icon has changed since preload was scheduled.
Proposed Guard
const marker = new Marker();
const iconBeforePreload = marker.getIcon();
const img = new Image();
img.onload = () => {
if (marker.getIcon() === iconBeforePreload) {
marker.setIcon('/default-open-pin.png');
}
};
img.src = '/default-open-pin.png';