Skip to content

Fix #12689 - Remove unnecessary src=null on WMS tile load error#12691

Open
offtherailz wants to merge 2 commits into
geosolutions-it:masterfrom
offtherailz:fix/wms-tile-error-null-src
Open

Fix #12689 - Remove unnecessary src=null on WMS tile load error#12691
offtherailz wants to merge 2 commits into
geosolutions-it:masterfrom
offtherailz:fix/wms-tile-error-null-src

Conversation

@offtherailz

Copy link
Copy Markdown
Member

Closes #12689

Removes image.getImage().src = null; from the tile load error handler in WMSLayer.js. Assigning null to an <img>'s src coerces to the literal string "null", causing a real (always-404) request to a relative URL named null.

The line immediately after it, image.setState(3), already sets OpenLayers' internal tile/image state to ERROR. Traced through ol/source/UrlTile.js (handleTileChange) and ol/source/Image.js (handleImageChange): both dispatch tileloaderror/imageloaderror purely based on that internal state, synchronously, with no dependency on the <img> element's native error DOM event. So the src = null line isn't needed for the error signal MapStore listens for (Map.onLayerError) — it's redundant, and its only effect is the spurious network request.

Verified locally: removing the line eliminates the /null requests while the layer's error state and onLayerError still propagate correctly.

…oad error

Setting img.src = null does not clear the image; the DOM coerces it
to the string "null", causing a real (always-404) network request.
image.setState(3) alone already triggers the source's
tileloaderror/imageloaderror events (state-based, no DOM event
dependency), making the src=null line redundant.
Verifies the tile error handler no longer sets img.src = null on failure.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WMS tile load error handler sets img.src = null, causing a spurious network request to a literal "null" URL

2 participants