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

Pin stays on the map when results of subsequent queries return #48

Open
xinyuluo opened this issue Mar 15, 2022 · 11 comments
Open

Pin stays on the map when results of subsequent queries return #48

xinyuluo opened this issue Mar 15, 2022 · 11 comments
Labels
help wanted Extra attention is needed

Comments

@xinyuluo
Copy link

Hi! thanks for the amazing project. I have encountered what I think is a bug, because i think it should be irrelevant to my choice of geocoder (Nominatim).

To reproduce the bug:

  1. search for "NUS singapore" (I have a map of singapore), press enter.
  2. click on the one that says National University of Singapore from the dropdown list, it zooms in closer to the place;
  3. click enter again and the map zooms in even closer;
  4. search for the next query "NUH singapore" (do not clear manually clear search box), which has 2 results from the drop down. But when I zoom out the map, the pin for National University of Singapore is still there.

Please see attached screen recording for the reference.

Thank you!

maplibre-geocoder.mp4
@wipfli
Copy link
Member

wipfli commented Mar 15, 2022

Thanks for reporting. Can you share a stackblitz or something similar?

@xinyuluo xinyuluo changed the title Pin stays on the map when results of subsequent queries returns Pin stays on the map when results of subsequent queries return Mar 16, 2022
@xinyuluo
Copy link
Author

xinyuluo commented Mar 21, 2022

@wipfli sure. demo is here: https://stackblitz.com/edit/web-platform-fszogw
you will need a maptiler API key to access the basemap. Do you have one?

@wipfli
Copy link
Member

wipfli commented Mar 22, 2022

Does the one for the MapLibre examples work? get_your_own_OpIi9ZULNHzrESv6T2vL from https://maplibre.org/maplibre-gl-js-docs/example/canvas-source/

@xinyuluo
Copy link
Author

Yes it will work. I've just updated stackblitz.

@wipfli
Copy link
Member

wipfli commented Mar 23, 2022

Cool, I can reproduce the bug you reported. Is there any chance that you can fix this behavior? I would be happy to review a pull request...

@wipfli
Copy link
Member

wipfli commented Mar 23, 2022

Maybe one has to loop through features. Here is a different example where I made only one marker being highlighted: https://codesandbox.io/s/hopeful-elion-w04kb6

@xinyuluo
Copy link
Author

How is the different example related to the bug?
I will try to read code more closely when I have the bandwidth. If i can come up with a fix i will submit a PR

@wipfli
Copy link
Member

wipfli commented Mar 23, 2022

Maybe it is not really related :S

@wipfli
Copy link
Member

wipfli commented Mar 23, 2022

Cool, thanks @xinyuluo !

@HarelM
Copy link
Collaborator

HarelM commented Aug 18, 2024

The code after #118 should be fully typescript, which should help in solving these kind of cases, and if not, refactoring would be a lot easier.
I see that there are promises returning from the geoApi, and there might be a race condition in this case, or a missing marker.remove call.
It should be fairly easy to solve this I hope.
Sorry for the late response...

@HarelM
Copy link
Collaborator

HarelM commented Aug 18, 2024

Can you reproduce this in the following example page:
https://maplibre.org/maplibre-gl-js/docs/examples/geocoder/
I can't reproduce it...

@HarelM HarelM added the help wanted Extra attention is needed label Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants