Answer the question
In order to leave comments, you need to log in
Why doesn't react leaflet geosearch research work?
There is a sample code on github
A simple react project with an added react-leaflet map and a search for react-leaflet-geosearch ( https://github.com/deadka1313/testleafletreact )
The essence of the question:
If you select the first place in the search, then it seems to work ok ( but the marker is not displayed correctly)
And if you enter it again (without clearing the search field by clicking on the cross), then an error occurs
. What could be the problem?
Answer the question
In order to leave comments, you need to log in
The problem is in this fix https://github.com/Leaflet/Leaflet/commit/f662d44a...
and in the fact that the hasLayer function receives a string, number and Layer as an argument, and the check occurs only for the number typeof layer === 'number' otherwise thinks it's a Layer.
According to the old condition, the check with the string passed,
but there was an error that if the layer id was not found, the id was checked as a layer and this led to an error
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question