Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cosme-benito opened this issue Sep 13, 2024 · 1 comment
Open

Comments

@cosme-benito
Copy link

cosme-benito commented Sep 13, 2024

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

@oliverheilig
Copy link
Member

Hi,

your proposal looks reasonable to me. The issue is that no one actively works on the project at the moment, but feel free to create a PR.

But then the question would be if you also want a new release. It has been more than 3 years since the last release (1.0.9), we would need to check how we can roll this out then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants