question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Removing map that has a tileLayer with minZoom set causes an error - undefined is not an object (evaluating 'el.style')

See original GitHub issue
  • 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 - https://github.com/PaulLeCam/react-leaflet/issues/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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
tkurkicommented, 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: https://github.com/PaulLeCam/react-leaflet/issues/625

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

0reactions
Malvozcommented, 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

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: undefined is not an object (evaluating 'items.map')
After receiving items, the following error occurs. At the moment I'm just learning and have looked at other answers on this topic, nothing...
Read more >
Leaflet 1.7 documentation - DevDocs
Returns the minimum zoom level of the map (if set in the minZoom option of the map or of any layers), or 0...
Read more >
typeerror: cannot read properties of undefined (reading 'lat')
If you want to prevent Map to be "undefined". First declare your map variable as public js variable (in the head of your...
Read more >
Create Interactive Web Maps with the JavaScript 'Leaflet' Library
If the error "Cannot read property 'appendChild' of undefined" occurs, make sure the pane being used for used for display has already been...
Read more >
Leaflet - a JavaScript library for interactive maps - GitHub Pages
setView( <LatLng> center, <Number> zoom?, <zoom/pan options> options? ) this, Sets the view of the map (geographical center and zoom) with the given...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found