leaflet-geosearch icon indicating copy to clipboard operation
leaflet-geosearch copied to clipboard

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

Open richsims opened this issue 3 years ago • 1 comments
trafficstars

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

richsims avatar May 10 '22 10:05 richsims

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,
  },
});

lelumees avatar Jun 02 '22 11:06 lelumees