Select to view content in your preferred language

4.32 Custom Search Sources Always Gets First Suggestion

519
3
Jump to solution
02-24-2025 09:54 AM
Justin_Greco
Frequent Contributor

I am working on upgrading an app from 4.30 to 4.32 which has custom search sources, similar to this sample:

https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=widgets-search-customsou...

However, it is always returning the first suggestion in the getResults method.  After trying the sample, I see the same behavior there as well.  It works correctly in the sample if I revert back to 4.31.

If I type "8 boul" in the search widget, and then select 8 La Boule 79240 Vernoux-en-Gatine, it selects and zooms to 8 Boule 22940 Plaintel, which is the first in the list.

 

Justin_Greco_0-1740419449458.png

Justin_Greco_1-1740419486007.png

Justin_Greco_2-1740419634038.png

 

 

0 Kudos
1 Solution

Accepted Solutions
Noah-Sager
Esri Regular Contributor

Hi @Justin_Greco, we may have found the issue. The "key" should be a unique identifier for the suggestion. Currently, the sample needs to be updated to reflect this (coming soon). If you modify line 79 of the sample to be be a unique identifier, it seems to work as expected for me. Can you test in your app?

Test-app

https://codepen.io/noash/pen/dPypPKG?editors=1010

Images of before and after of code from sample attached.

 

View solution in original post

0 Kudos
3 Replies
Noah-Sager
Esri Regular Contributor

Thanks for reporting, and for testing so quickly @Justin_Greco. I see the behavior in the sample. We are investigating.

0 Kudos
Noah-Sager
Esri Regular Contributor

Hi @Justin_Greco, we may have found the issue. The "key" should be a unique identifier for the suggestion. Currently, the sample needs to be updated to reflect this (coming soon). If you modify line 79 of the sample to be be a unique identifier, it seems to work as expected for me. Can you test in your app?

Test-app

https://codepen.io/noash/pen/dPypPKG?editors=1010

Images of before and after of code from sample attached.

 

0 Kudos
Justin_Greco
Frequent Contributor

Just tested in my app and that fixed it!  Thanks for the quick response.