smeijer / leaflet-geosearch

A geocoding/address-lookup library supporting various api providers.
https://smeijer.github.io/leaflet-geosearch/
MIT License
1.02k stars 270 forks source link

Uncaught TypeError: Cannot read properties of undefined (reading 'disableClickPropagation') #328

Closed sammertime closed 1 year ago

sammertime commented 2 years ago

Hi,

I'm new to frontend development so apologies if this is ultimately user error : /

I've followed the instructions as documented to integrate a search box using this package onto a leaflet map. While I am able to 1.) get the search box to show on the map using OpenStreetMapProvider as the provider and 2.) have what I type in autocomplete, I'm getting the following error in the console when my web page loads:

Uncaught TypeError: Cannot read properties of undefined (reading 'disableClickPropagation')

This error is occurring on my "map.addControl(searchControl);" line of the code (attached).

map.txt

I'm using the parcel bundler, npm for package installs, the latest versions of leaflet and leaflet-geosearch, and google chrome for the browser.

My hope is that this isn't user error and I've identified a bug but I'm definitely not betting on that..I've gone over this documentation many times and I'm scratching my head as to why I'm getting this error when my page loads. Might this happen to have anything to do with leaflet-geosearch or is it user error?

Also of note aside from this error - when I click one of the autocomplete suggestions from the drop-down, the map fails to recenter and I get another error... but I'm assuming that's related to the error I've provided some detail on above so I'm waiting to solve that first.

Many thanks.

sammertime commented 1 year ago

Determined this was an issue with my local packages installed with npm..it works when I use the unpkg cdn..only took me a month to figure out 😭