Skip to content

Crash in leaflet.js when reload the map #67

@liviolima80

Description

@liviolima80

Good morning,
I have found a possible bug using the library when you reload the map too quick. Let you consider your example "RealTimeMap Geometric.Points collection". If you run the server you see the map as "Home" page. Let consider the following action:

  • click on "Add more" button in "Home" page
  • click on "Counter" menu on the left
  • click agin on "Home" within 5 seconds
  • click again on "Add more" button

My behaviour is that the application crash. Using in debug the error stack trace is the following

TypeError: Cannot read properties of undefined (reading 'x')
Analisi dello stack:

at f.intersects (https://unpkg.com/leaflet@1.9.3/dist/leaflet.js:5:10006)
at e._empty (https://unpkg.com/leaflet@1.9.3/dist/leaflet.js:5:80140)
at e._updateCircle (https://unpkg.com/leaflet@1.9.3/dist/leaflet.js:5:130722)
at e._updatePath (https://unpkg.com/leaflet@1.9.3/dist/leaflet.js:5:80056)
at e._update (https://unpkg.com/leaflet@1.9.3/dist/leaflet.js:5:80003)
at e._reset (https://unpkg.com/leaflet@1.9.3/dist/leaflet.js:5:79030)
at e.onAdd (https://unpkg.com/leaflet@1.9.3/dist/leaflet.js:5:78416)
at e._layerAdd (https://unpkg.com/leaflet@1.9.3/dist/leaflet.js:5:67012)
at e.whenReady (https://unpkg.com/leaflet@1.9.3/dist/leaflet.js:5:43272)
at e.addLayer (https://unpkg.com/leaflet@1.9.3/dist/leaflet.js:5:67235)

If you repeat the process but you wait more than 10 seconds to come back on "Home" page to reload the map, the apllication does not crash.

I found something similar on google

https://stackoverflow.com/questions/72446783/leaflet-geojson-uncaught-typeerror-cannot-read-properties-of-undefined-reading

It look like tha map object is automatically destroyed after a while

Do you have an idea how to fix the issue?

Regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions