Skip to content

Removing the layer from the map should cancel pending HTTP requests #463

@cosme-benito

Description

@cosme-benito

TL;DR: When you remove a NonTiledLayer from the map, it should cancel the pending HTTP requests. This can be done with something like

_abortLoading() {
    const image = this._useCanvas
      ? this._currentCanvas._image
      : this._currentImage;

    if (image != null) {
      image.src = this.emptyImageUrl;
      image.onload = Util.falseFn;
      image.onerror = Util.falseFn;
    }
  },

The problem I encountered is a bit wonky but can be reliably reproduced:

  • Put a breakpoint on the WMS server, preventing it from answering HTTP requests
  • Add NonTiledLayer to the map
  • Remove the NonTiledLayer from the map
  • Add the (same) NonTiledLayer to the map again
  • Remove the breakpoint on the WMS server, resume flow as normal
  • The layer does not show up in on the map. If you zoom in/out it shows up.

What's currently happening:

  • A single HTTP request is pending

image

What I expected to happen:

  • The first request should have been canceled
  • A second request should have been fired
  • This would fix the problem

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions