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 map that has a tileLayer with minZoom set causes an error - undefined is not an object (evaluating 'el.style') #6486

Closed
5 tasks done
bradcrawford opened this issue Jan 22, 2019 · 5 comments

Comments

@bradcrawford
Copy link

  • I've looked at the documentation to make sure the behavior is documented and expected
  • I'm sure this is a Leaflet code issue, not an issue with my own code nor with the framework I'm using (Cordova, Ionic, Angular, React…)
  • I've searched through the issues to make sure it's not yet reported

Steps to reproduce
https://codesandbox.io/s/ywn94996wj

  1. Zoom out to the point where the high res tileLayer (url set to cloudfront) disappears due to it's minZoom setting.
  2. Click the Hide button.
  3. Error (see image below)
  4. Remove minZoom: 18
  5. Repeat steps 1 & 2 above
  6. No error

Expected behavior
When using a tileLayer with minZoom set and the map zoomed out beyond the value of minZoom, removing the map should not cause an error

Current behavior
When using a tileLayer with minZoom set and the map zoomed out beyond the value of minZoom, removing the map causes an error

screen shot 2019-01-22 at 9 41 46 pm

Environment

  • Leaflet version: 1.4.0
  • Browser (with version): Safari 11.0.1
  • OS/Platform (with version): Mac OS Sierra 10.12.6

Additional context
Uncovered while using ReactLeaflet, initial bug report here - PaulLeCam/react-leaflet#551. Further investigation revealed that it appears to be a Leaflet issue.

Minimal example reproducing the issue

https://codesandbox.io/s/ywn94996wj

  • this example is as simple as possible
  • this example does not rely on any third party code
@IvanSanchez
Copy link
Member

Cannot reproduce with Firefox nor Chrome on Linux. Is this a Safari-specific issue?

@bradcrawford
Copy link
Author

bradcrawford commented Jan 22, 2019

I don't believe so @IvanSanchez. I get the same error in the console in all 3 browsers. This gif is from chrome.

steps-to-reproduce

Here is a slightly simpler example that errors for me in both Chrome 71 and Firefox 60 as well as Safari- https://plnkr.co/edit/T4qExnzu7KzbDJkIZlJK?p=preview

@cherniavskii
Copy link
Sponsor Collaborator

cherniavskii commented Jan 22, 2019

I confirm.

Looks like _destroyAnimProxy gets called before zoomend handler:

Leaflet/src/map/Map.js

Lines 1619 to 1623 in 61ef177

this.on('load moveend', function () {
var c = this.getCenter(),
z = this.getZoom();
DomUtil.setTransform(this._proxy, this.project(c, z), this.getZoomScale(z, 1));
}, this);

@tkurki
Copy link

tkurki commented Oct 20, 2019

This is pretty bothersome, as it will kill an unsuspecting (=not expecting errors from a normal operation) React app hiding/removing a React Leaflet Map: PaulLeCam/react-leaflet#625

This is the simplest reproduction I can think of in case it is any help: https://codepen.io/tkurki/pen/XWWNBmr

@Malvoz
Copy link
Member

Malvoz commented Jul 28, 2022

This is the simplest reproduction I can think of in case it is any help: https://codepen.io/tkurki/pen/XWWNBmr

Not able to reproduce using v1.8.0: https://plnkr.co/edit/SudJnPOVbG7Y901P?preview

@Malvoz Malvoz closed this as completed Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants