smeijer / leaflet-geosearch

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

SearchControl.ts:414 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'draggable') #325

Open richsims opened 2 years ago

richsims commented 2 years ago

Hello,

I'm using leaflet 1.8.0, react-leaflet 3.2.5 and the latest version of leaflet-geosearch.

It used to work fine, but despite not changing the versions of any of the dependencies (I know! somehow I must have done!) I now get the following error when doing a search:

SearchControl.ts:414 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'draggable') at NewClass.addMarker (SearchControl.ts:414:1) at NewClass.showResult (SearchControl.ts:382:1) at SearchControl.ts:369:1

NOTE: in the network panel I can see the search to the googlemaps API being made, and a valid response coming back.

It used to show a list of the results underneath the search bar, but nothing now comes up.

I've tried various browsers, versions of leaftlet/react-leaflet and leaflet-geosearch but always now end-up with the same error.

Any thoughts? I'm a bit stuck.

Rich

lelumees commented 2 years ago

Same here, looks like some internal issues, although I faced it after React upgrade from 16 to 17. I solved it by providing a marker prop (could be an empty object as well I suppose) during SearchControl initialisation:

const searchControl = SearchControl({
  provider,
  // ...
  marker: {
    draggable: false,
  },
});