You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I type something in the Geocoder then select an option, the result event is seemingly invoked twice with the same result.
Reacted by Michael Clark, brambow, Arnaud Weyts, Steve, Serg, Paresh Radadiya, Michael Keyser, Udgam Mehetre, Sheridan Kates, Björn Hinkeldey and 4 more
This is causing issues for me in a situation where I am trying to animate some layers that contain the resulting point of a geocode operation. Since the result is invoked twice, my animation runs twice and looks weird. Any ideas for a workaround appreciated.
Throwing in my request for a fix as well (preferably one that satisfies IE11). My current solution is to set up global to store the latlng and check to see if the new event is different than the last. Clearly not the most elegant solution.
@andrewharvey sometimes I also see only one result event.
It seems like it depends on
what you are searching for
which option is selected (if there are more than one)
if there were geocoder searches before without reloading the page
With the following steps I get always a second result event after a click with the left mouse button (just noticed that the click must not be necessarily on the map, e.g. a click on the console triggers also the 2nd event):
Type Miami in the Geocoder of the jsbin I've posted above.
@pathmapper Right, that's because hitting enter selects the result, but doesn't blur the input, only when you click the map does the input blur and it triggers result again.
I believe that points back to tristen/suggestions#13 where the issue was ensuring result is triggered in all interactions (keyboard, mouse) across all supported browsers (IE11 was the issue), it was easy to fix for modern browsers, but I couldn't find a way to fix it such that it didn't break IE11.
#218 implemented a workaround the underlying bug in the upstream suggestions library. So I'll go ahead and close this as the bug shouldn't be noticeable to end users anymore. This is slated for v4 release.
Activity
[-]result event is called twice[/-][+]result event is invoked twice[/+]andrewharvey commentedon Feb 23, 2017
This is an upstream issue in suggestions, see tristen/suggestions#13
brambow commentedon Jun 13, 2017
This is causing issues for me in a situation where I am trying to animate some layers that contain the resulting point of a geocode operation. Since the result is invoked twice, my animation runs twice and looks weird. Any ideas for a workaround appreciated.
andrewharvey commentedon Jun 13, 2017
@brambow Do you mind testing the proposed solution at tristen/suggestions#13
I didn't notice any issue, if you don't either we can try to get a fix for this!
brambow commentedon Jun 13, 2017
Yep. That seems to fix it.
ckc11 commentedon Jun 13, 2017
This also fixed it for me as well.
andrewharvey commentedon Jul 7, 2017
Just noting that removing this code does fix it for modern browsers but breaks it for IE11. tristen/suggestions#13 (comment)
jwhazel commentedon Aug 3, 2017
Throwing in my request for a fix as well (preferably one that satisfies IE11). My current solution is to set up global to store the
latlngand check to see if the new event is different than the last. Clearly not the most elegant solution.pathmapper commentedon Sep 2, 2018
Using GL JS
v0.48.0and Geocoderv2.3.0, it looks like the behavior changed a bit compared to #99 (comment):The second
resultevent is now fired after a click on the map (Chrome on Linux):https://jsbin.com/dapurelime/edit?html,console,output
andrewharvey commentedon Sep 3, 2018
That's interesting, I'm also running Chrome on Linux and can't replicate that, in fact I'm only ever seeing the result event emitted once. 🤔
pathmapper commentedon Sep 3, 2018
@andrewharvey sometimes I also see only one result event.
It seems like it depends on
With the following steps I get always a second result event after a click with the left mouse button (just noticed that the click must not be necessarily on the map, e.g. a click on the console triggers also the 2nd event):
Miamiin the Geocoder of the jsbin I've posted above.enteron your keybord.andrewharvey commentedon Sep 3, 2018
@pathmapper Right, that's because hitting enter selects the result, but doesn't blur the input, only when you click the map does the input blur and it triggers result again.
I believe that points back to tristen/suggestions#13 where the issue was ensuring result is triggered in all interactions (keyboard, mouse) across all supported browsers (IE11 was the issue), it was easy to fix for modern browsers, but I couldn't find a way to fix it such that it didn't break IE11.
fix(geocoder): workaround mapbox-gl-geocoder result issue firing twice
fix(geocoder): workaround mapbox-gl-geocoder result issue firing twice
Merge pull request #218 from mapbox/deduplicate-result-event
andrewharvey commentedon Mar 21, 2019
#218 implemented a workaround the underlying bug in the upstream suggestions library. So I'll go ahead and close this as the bug shouldn't be noticeable to end users anymore. This is slated for v4 release.