A
A
Alexey Malyshev2020-10-23 16:59:23
leaflet
Alexey Malyshev, 2020-10-23 16:59:23

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
WOl76.png
. What could be the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aleksey_000, 2020-10-24
@Aleksey_000

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,
BAB4d0VI-AE.jpg
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 question

Ask a Question

731 491 924 answers to any question