Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A bug is detected when the text is deleted and another address is returned. #21

Open
alberto-perdiguero opened this issue Sep 10, 2020 · 3 comments

Comments

@alberto-perdiguero
Copy link

When you search for a new address without clicking on the close icon, but instead you delete the text and type again, the following error occurs:
Cannot create property '_leaflet_id' on string '193'.

If you press the close or search icon again, the component works again.

@darrenklein
Copy link
Contributor

darrenklein commented Nov 28, 2020

@alberto-perdiguero contrary to a previous message I posted, I was able to replicate this bug - I had to set the keepResult: true in the geosearch options. In my case, the full error is

Uncaught (in promise) TypeError: Cannot create property '_leaflet_id' on string '106'
    at stamp (leaflet-src.js?e11e:69)
    at NewClass.getLayerId (leaflet-src.js?e11e:6884)
    at NewClass.hasLayer (leaflet-src.js?e11e:6810)
    at NewClass.removeLayer (leaflet-src.js?e11e:6934)
    at NewClass.showResult (leafletControl.js?3e93:338)
    at NewClass.eval (leafletControl.js?3e93:325)
    at eval (eval at processIncludes (runtime.js?b89b:152), <anonymous>:3:4725)

One way to deal with this is to simply set keepResult to false (which is the default), but that doesn't fix the bug so much as it just pretends it doesn't exist. If keeping the result is important to your use case, then we'll need to find a fix...

@darrenklein
Copy link
Contributor

darrenklein commented Nov 28, 2020

@alberto-perdiguero actually, this bug originated in the leaflet-geosearch module, and has been fixed there in a recent update. If you update to the latest version of this repo, which uses version 3.1.0 of leaflet-geosearch, that will resolve the problem.

Note that this update hasn't been deployed to NPM yet, so you'll need to use the Github source until then.

This issue can be marked as closed.

@cybergears
Copy link

cybergears commented Jul 8, 2021

This bug is still there in "leaflet-geosearch": "^3.3.2",

if you add autoClose: true in geosearchoptions it will work fine

geosearchOptions: { // Important part Here
provider: new OpenStreetMapProvider(),
autoClose: true
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants