streamlit-folium icon indicating copy to clipboard operation
streamlit-folium copied to clipboard

Cannot read property 'x' of undefined

Open lewymati opened this issue 1 year ago • 2 comments
trafficstars

I observed that with streamlit_folium==0.20.0 the draw plugin sometimes breaks (usually after rerendering the map). In console I could see a lot Cannot read property 'x' of undefined js errors.

To me the issue resembles the one here: https://github.com/vue-leaflet/vue-leaflet/issues/144 It seems its relevant how the leaflet is imported, see this comment

I suspect that the culprit is #181, as after downgrading to streamlit_folium==0.19.1, the issue was no longer there.

(for reference, I use: streamlit==1.34.0 folium==0.16.0 )

lewymati avatar May 29 '24 08:05 lewymati

Thanks for reporting... @hansthen, would you have any insight here about why this might happen? The comment listed references adding :use-global-leaflet="true", but not being a leaflet expert I'm not sure what the behavior is here.

randyzwitch avatar May 29 '24 19:05 randyzwitch

Funny, I had a problem with the Draw plugin in the 0.19 versions, also with undefined errors and 0.20 fixed it for me.

I checked locally, but I was unable to reproduce the issue. My first instinct would be that the reported error from "vue-leaflet" is a red herring. There are many ways an undefined error can occur. However, without being able to reproduce it locally, I cannot come to any firm conclusions.

@lewymati can you add a small code sample that (at least sometimes) demonstrates this issue? You say it happens after a redraw of the map. What did you do to trigger a redraw? Also what browser are you using?

hansthen avatar May 31 '24 17:05 hansthen

Closing, as it doesn't seem like it's happening enough to make numerous people have issues. If this arises again, please post a reproducible example and we'll re-open

randyzwitch avatar Nov 07 '24 17:11 randyzwitch