maplibre-gl-js version: 5.18.0
browser: Firefox, Chromium
Summary
Calling source.setUrl(...) on a raster source does not abort in-flight raster tile requests if the tilejson request has already completed. The abort only occurs if setUrl is called before the tilejson response arrives. As a result, the map continues loading tiles from the old URL(s) after setUrl is invoked.
Steps to Trigger Behavior
- Add a raster source and raster layer.
- Wait until the tilejson request completes (so tile URLs are known) but before all raster tiles have finished loading.
- Call
source.setUrl(newUrl).
- Observe that in-flight raster tiles continue to load for the previous URL(s).
Link to Demonstration
Example demonstrating this behavior using a custom protocol: https://gist.github.com/terraputix/cbc40bbf92612e9c13fd795ab1eef247
If the source is removed and re-added the inflight tile-requests are correctly aborted: https://gist.github.com/terraputix/9fa7f1b6168b61ae9187c20d49f98c39. This mitigates my problem, but avoiding visual flickering using this pattern is tedious.
Expected Behavior
Abort inflight tile requests for previous URL when setUrl is called.
Actual Behavior
Inflight requests are only aborted if setUrl is called before the tilejson is returned.
maplibre-gl-js version: 5.18.0
browser: Firefox, Chromium
Summary
Calling
source.setUrl(...)on a raster source does not abort in-flight raster tile requests if the tilejson request has already completed. The abort only occurs ifsetUrlis called before the tilejson response arrives. As a result, the map continues loading tiles from the old URL(s) aftersetUrlis invoked.Steps to Trigger Behavior
source.setUrl(newUrl).Link to Demonstration
Example demonstrating this behavior using a custom protocol: https://gist.github.com/terraputix/cbc40bbf92612e9c13fd795ab1eef247
If the source is removed and re-added the inflight tile-requests are correctly aborted: https://gist.github.com/terraputix/9fa7f1b6168b61ae9187c20d49f98c39. This mitigates my problem, but avoiding visual flickering using this pattern is tedious.
Expected Behavior
Abort inflight tile requests for previous URL when
setUrlis called.Actual Behavior
Inflight requests are only aborted if
setUrlis called before the tilejson is returned.