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:412 Uncaught (in promise) when clicking a result #317

Open nobbiexxx opened 2 years ago

nobbiexxx commented 2 years ago

Hi

I'm using geosearch with Leaflet Js I have included the script after the Leaflet script and this

new GeoSearch.GeoSearchControl({
    provider: new GeoSearch.OpenStreetMapProvider(),
}).addTo(map);

The search works fine and produces results but when I click on a search result I get this in the console.

SearchControl.ts:412 Uncaught (in promise) TypeError: Cannot convert undefined or null to object at Function.keys () at i.showResult (SearchControl.ts:412:28) at SearchControl.ts:404:12

Screenshot 2022-03-24 at 18 28 24

Any help much appreciated

darrenklein commented 2 years ago

@nobbiexxx out of curiosity, does that also happen if you click on the map, rather than on the result? As in, run the search as you did, but then instead of clicking on the result, click the map (sorry if that was obvious).

nobbiexxx commented 2 years ago

Hi

No it only happens when I click a search result

On Thu, 24 Mar 2022 at 20:04, Darren @.***> wrote:

@nobbiexxx https://github.com/nobbiexxx out of curiosity, does that also happen if you click on the map, rather than on the result? As in, run the search as you did, but then instead of clicking on the result, click the map (sorry if that was obvious).

— Reply to this email directly, view it on GitHub https://github.com/smeijer/leaflet-geosearch/issues/317#issuecomment-1078107391, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6GNDXDTIKA4MN5AAMELFDVBTDERANCNFSM5RR6JCCQ . You are receiving this because you were mentioned.Message ID: @.***>

-- Neil Lewes.co.uk http://www.lewes.co.uk

darrenklein commented 2 years ago

Thanks - I thought I'd seen something like this when experimenting with all local versions of this app and its dependencies, must've been something else (it's been a few months, so my memory may have been a bit hazy).

nobbiexxx commented 2 years ago

Hi Darren

Thanks very much for getting back to me

Do you have any idea why the result value would be null?

I’m assuming that’s what the problem is.

On Thu, 24 Mar 2022 at 21:36, Darren @.***> wrote:

Thanks - I thought I'd seen something like this when experimenting with all local versions of this app and its dependencies, must've been something else (it's been a few months, so my memory may have been a bit hazy).

— Reply to this email directly, view it on GitHub https://github.com/smeijer/leaflet-geosearch/issues/317#issuecomment-1078409017, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6GNDRF6NV6UCPALWPYPDTVBTN67ANCNFSM5RR6JCCQ . You are receiving this because you were mentioned.Message ID: @.***>

-- Neil Lewes.co.uk http://www.lewes.co.uk

darrenklein commented 2 years ago

No, I'm sorry, I don't have any insight into this offhand. The issue sounded similar to something that I'd encountered while working with local copies of this app and its dependencies (as opposed to installing them from NPM), but I'm not really a Node expert so I couldn't debug it. I had assumed that the problem in my case was something going awry in the build process (since the problem went away when I switched to NPM sources), but I that was only a "best guess" on my part.

Though I'm not in a position to help with this particular issue right now, you could definitely help the repo owner or another dev debug this by providing a little more information about your situation. I'd suggest

nobbiexxx commented 2 years ago

Hi Darren

Thanks for that, I'm not using Node though I'm just including this file https://unpkg.com/leaflet-geosearch@3.0.0/dist/geosearch.umd.js

The problem occurs in Safari Version 14.1.2 (16611.3.10.1.6) and Chrome Version 99.0.4844.74 (Official Build) (x86_64)

nobbiexxx commented 2 years ago

I have updated to v3.6.0 and I am still getting this error when I click on a search result. I'm using the latest stable version of Leaflet. This happens in all browsers I have tried it in btw.

Uncaught (in promise) TypeError: Cannot convert undefined or null to object at Function.keys () at i.showResult (SearchControl.ts:412:28) at SearchControl.ts:404:12