<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: React: Clicking on a Search widget suggestion does nothing ('select-result' event does not fire) in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1073361#M73660</link>
    <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/335589"&gt;@shaylavi&lt;/a&gt;Awesome, I'm happy to hear it will be fixed in the next release. Thank you!&lt;/P&gt;</description>
    <pubDate>Mon, 28 Jun 2021 18:04:04 GMT</pubDate>
    <dc:creator>ShellyM</dc:creator>
    <dc:date>2021-06-28T18:04:04Z</dc:date>
    <item>
      <title>React: Clicking on a Search widget suggestion does nothing ('select-result' event does not fire)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1058764#M73145</link>
      <description>&lt;P&gt;Hello all, I am working on a React app and having a difficult time trying to get the Search widget to work. I am using esri-loader and ArcGIS API for JavaScript 4.19.&lt;/P&gt;&lt;P&gt;I added a Search widget to my map and everything seems to be working fine up until the point when you try to click on one of the search (autocomplete) suggestions. Clicking on a suggestion closes the list of suggestions, however, the 'select-result' event never fires and the map never navigates to the selected feature. I'm trying this on a feature layer/service that supports pagination and has geometry associated with it. I'm not seeing anything in the console.&lt;/P&gt;&lt;P&gt;If I turn autoselect ON, the select-result event fires and the map will move, but it will &lt;STRONG&gt;always&lt;/STRONG&gt; go to the first item in the suggestion list, which is not what I want.&lt;/P&gt;&lt;P&gt;Any ideas on why it's not working as expected with autoselect off? I'm out of ideas and not sure how to proceed.&lt;/P&gt;&lt;P&gt;Here is a sample of the code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;this.searchWidget = new Search({
      view: this.view,
      locationEnabled: false,
      autoSelect: false,
      includeDefaultSources: false,
      sources: []
});
this.view.ui.add(this.searchWidget, { position: "top-right" });

// attached this listener; it is not firing
this.searchWidget.on("select-result", (event) =&amp;gt; {
      console.log(event);
});

this.lakes = new FeatureLayer({
      id: "lakeLayer",
      url: url,
      definitionExpression: "state='CA'",
      outFields: ["*"],
      renderer: lakesRenderer,
      popupTemplate: lakesTemplate
});

this.searchWidget.sources.add({
      layer: this.lakes,
      searchFields: ["assessmentunitname"],
      displayField: "assessmentunitname",
      exactMatch: false,
      outFields: ["*"],
      name: "Lakes &amp;amp; Areas",
      placeholder: "Search"
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you-&lt;/P&gt;</description>
      <pubDate>Mon, 17 May 2021 23:11:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1058764#M73145</guid>
      <dc:creator>ShellyM</dc:creator>
      <dc:date>2021-05-17T23:11:34Z</dc:date>
    </item>
    <item>
      <title>Re: React: Clicking on a Search widget suggestion does nothing ('select-result' event does not fire)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1059004#M73158</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/485043"&gt;@ShellyM&lt;/a&gt;,&amp;nbsp;this is an interesting question. I'm not sure off the top of my head, but I think we should try to simplify the workflow to narrow down the issue. Below is a simple JavaScript app that uses one featureLayer with a definitionExpression as the source for a Search widget. Can you try with your data and confirm if this works as expected?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;test-app&lt;/P&gt;&lt;P&gt;&lt;A href="https://codepen.io/noash/pen/MWpjdvv?editors=1000" target="_blank"&gt;https://codepen.io/noash/pen/MWpjdvv?editors=1000&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 May 2021 15:44:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1059004#M73158</guid>
      <dc:creator>Noah-Sager</dc:creator>
      <dc:date>2021-05-18T15:44:21Z</dc:date>
    </item>
    <item>
      <title>Re: React: Clicking on a Search widget suggestion does nothing ('select-result' event does not fire)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1059117#M73161</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/169842"&gt;@Noah-Sager&lt;/a&gt;, I tried it with my own data and it works as expected. &lt;A href="https://codepen.io/shell_m/pen/MWpbWQZ" target="_blank"&gt;https://codepen.io/shell_m/pen/MWpbWQZ&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 May 2021 19:08:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1059117#M73161</guid>
      <dc:creator>ShellyM</dc:creator>
      <dc:date>2021-05-18T19:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: React: Clicking on a Search widget suggestion does nothing ('select-result' event does not fire)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1059120#M73162</link>
      <description>&lt;P&gt;Excellent. This is progress. Can you try instantiating the Search widget the same way in the React app? Instead of initializing it with an empty array for the sources, and then adding the layerSource to the widget.&lt;/P&gt;</description>
      <pubDate>Tue, 18 May 2021 19:17:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1059120#M73162</guid>
      <dc:creator>Noah-Sager</dc:creator>
      <dc:date>2021-05-18T19:17:17Z</dc:date>
    </item>
    <item>
      <title>Re: React: Clicking on a Search widget suggestion does nothing ('select-result' event does not fire)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1059128#M73163</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/169842"&gt;@Noah-Sager&lt;/a&gt;, I used the same code from the codepen and put it in my React app. The only two differences are that I am using esri-loader and I also changed the view container.&lt;/P&gt;&lt;P&gt;Now I'm having the same issue as before. The search suggestions come up just fine, but clicking on a suggestion doesn't do anything (it doesn't even update the search box text). If I type something in the search box and then click on the magnifying glass icon (instead of clicking on a suggestion), then the map will go to the first feature in the suggestion list.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;componentDidMount() {
       loadModules(['esri/Map', 'esri/views/MapView', 'esri/layers/FeatureLayer', 'esri/widgets/Search', 'esri/tasks/Locator'])
       .then(([Map, MapView, FeatureLayer, Search, Locator]) =&amp;gt; {
            const map = new Map({
                basemap: "gray-vector"
            });
            const view = new MapView({
                container: this.mapRef.current,
                map: map,
                center: [-119.36, 37.504], // lon, lat
                zoom: 5
            });
            const lakes = new FeatureLayer({
                url: "https://gispublic.waterboards.ca.gov/portalserver/rest/services/Hosted/All_CA_Named_Streams_and_Lakes/FeatureServer/1",
                definitionExpression: "county='Placer'",
                popupTemplate: {
                    title: "{name}"
                }
            });

            map.add(lakes);

            const searchWidget = new Search({
                view: view,
                includeDefaultSources: false,
                sources: [{
                    layer: lakes,
                    searchFields: ["name"],
                    displayField: "name",
                    exactMatch: false,
                    outFields: ["*"],
                    name: "Lakes",
                    placeholder: "example: Lake Tahoe"
                }]
            });

            view.ui.add(searchWidget, {
                position: "top-right"
            });
        });
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;render() {
        return (
            &amp;lt;div 
                className="map" 
                ref={this.mapRef} 
                style={{ width: "60vw", height: `calc(100vh - 60px)` }} /&amp;gt;
        )
    }&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 18 May 2021 19:44:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1059128#M73163</guid>
      <dc:creator>ShellyM</dc:creator>
      <dc:date>2021-05-18T19:44:35Z</dc:date>
    </item>
    <item>
      <title>Re: React: Clicking on a Search widget suggestion does nothing ('select-result' event does not fire)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1059132#M73164</link>
      <description>&lt;P&gt;Ok, thanks for the update. Let me do some additional digging and I'll respond back here when I have an update.&lt;/P&gt;</description>
      <pubDate>Tue, 18 May 2021 19:52:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1059132#M73164</guid>
      <dc:creator>Noah-Sager</dc:creator>
      <dc:date>2021-05-18T19:52:05Z</dc:date>
    </item>
    <item>
      <title>Re: React: Clicking on a Search widget suggestion does nothing ('select-result' event does not fire)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1059161#M73168</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/485043"&gt;@ShellyM&lt;/a&gt;,&amp;nbsp;I think we're making progress. I worked with the infamous Rene Rubalcava on this and we got a test-app with React and esri-loader that seems to work fine:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://codesandbox.io/s/agitated-leavitt-1phqw?file=/src/App.js" target="_blank"&gt;https://codesandbox.io/s/agitated-leavitt-1phqw?file=/src/App.js&lt;/A&gt;&lt;/P&gt;&lt;P&gt;If you're using class based React components, it sounds like there could be some DOM update interactions that are causing the issue. With lots of "this" references and the React DOM stuff, it's difficult to say for certain though.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 May 2021 20:40:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1059161#M73168</guid>
      <dc:creator>Noah-Sager</dc:creator>
      <dc:date>2021-05-18T20:40:01Z</dc:date>
    </item>
    <item>
      <title>Re: React: Clicking on a Search widget suggestion does nothing ('select-result' event does not fire)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1059239#M73170</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/169842"&gt;@Noah-Sager&lt;/a&gt;, many thanks to you (and Rene) for looking into this.&lt;/P&gt;&lt;P&gt;I rewrote my class component as a functional component similar to what's in your codepen and unfortunately it's still doing it. Clearly there is some conflict with the React setup I have (which is a bare bones starter using Gatsby v3.4.1).&lt;/P&gt;&lt;P&gt;I then created a new app with create-react-app and tried it in that environment, similar to your codepen. The search widget works as expected in create-react-app, confirming that the issue stems from some conflict with Gatsby and/or the Gatsby setup.&lt;/P&gt;&lt;P&gt;As for the app, I'll have to think about what to do next. Thanks for troubleshooting with me.&lt;/P&gt;</description>
      <pubDate>Tue, 18 May 2021 23:16:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1059239#M73170</guid>
      <dc:creator>ShellyM</dc:creator>
      <dc:date>2021-05-18T23:16:37Z</dc:date>
    </item>
    <item>
      <title>Re: React: Clicking on a Search widget suggestion does nothing ('select-result' event does not fire)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1059415#M73184</link>
      <description>&lt;P&gt;We see this same issue in a Vue 2.x app that is also using esri-loader. First appears for us in&amp;nbsp;ArcGIS API for JavaScript 4.17. Issue does not appear when using older versions, and we've had to leave our app pinned to v4.15.&lt;/P&gt;</description>
      <pubDate>Wed, 19 May 2021 14:21:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1059415#M73184</guid>
      <dc:creator>ClintonCrick</dc:creator>
      <dc:date>2021-05-19T14:21:04Z</dc:date>
    </item>
    <item>
      <title>Re: React: Clicking on a Search widget suggestion does nothing ('select-result' event does not fire)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1059592#M73189</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/213942"&gt;@ClintonCrick&lt;/a&gt;This did it. I changed the esri-loader default options to use v4.15 and the Search widget now works in my React/Gatsby app. Thank you!&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/169842"&gt;@Noah-Sager&lt;/a&gt;Is there any chance of ESRI looking into what changed in v4.17 and fixing it in a future release?&lt;/P&gt;</description>
      <pubDate>Wed, 19 May 2021 18:57:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1059592#M73189</guid>
      <dc:creator>ShellyM</dc:creator>
      <dc:date>2021-05-19T18:57:07Z</dc:date>
    </item>
    <item>
      <title>Re: React: Clicking on a Search widget suggestion does nothing ('select-result' event does not fire)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1059606#M73191</link>
      <description>&lt;P&gt;Interesting. To be clear, the latest version it works at is 4.15 or 4.16? I don't see any changes to Search at 4.16 or 4.17, which also makes me wonder if there are issues with other widgets with these frameworks. It also might help if you could zip up an entire simplified project and send it over for further investigation. You can message me directly if you don't want to post it here.&lt;/P&gt;</description>
      <pubDate>Wed, 19 May 2021 19:11:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1059606#M73191</guid>
      <dc:creator>Noah-Sager</dc:creator>
      <dc:date>2021-05-19T19:11:48Z</dc:date>
    </item>
    <item>
      <title>Re: React: Clicking on a Search widget suggestion does nothing ('select-result' event does not fire)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1059659#M73196</link>
      <description>&lt;P&gt;Yes. For me, 4.16 is the latest version it works at. 4.17 (and everything after) breaks it.&lt;/P&gt;&lt;P&gt;I can pull something together and send it to you by the end of the day tomorrow&lt;/P&gt;</description>
      <pubDate>Wed, 19 May 2021 20:16:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1059659#M73196</guid>
      <dc:creator>ShellyM</dc:creator>
      <dc:date>2021-05-19T20:16:40Z</dc:date>
    </item>
    <item>
      <title>Re: React: Clicking on a Search widget suggestion does nothing ('select-result' event does not fire)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1070564#M73564</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/169842"&gt;@Noah-Sager&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I'm experiencing the same issue with VueJS. Spent a few good hours tracing the source. I thought its styling but it's definitely the esri-loader - I didn't test it isolated yet outside of VueJS, but pretty confident that it will be reproduced.&lt;/P&gt;&lt;P&gt;The esri-loader doesn't seem to be maintained much in terms of issues and unfortunately ESM fails to be integrated with the Vue setup I'm facing.&lt;/P&gt;&lt;P&gt;Would be good to find a workaround for this. It seems to be the behaviour of the dropdown list implemented in the widget&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jun 2021 16:49:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1070564#M73564</guid>
      <dc:creator>shaylavi</dc:creator>
      <dc:date>2021-06-21T16:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: React: Clicking on a Search widget suggestion does nothing ('select-result' event does not fire)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1071799#M73606</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/485043"&gt;@ShellyM&lt;/a&gt;&amp;nbsp;you might be happy to hear that I found a better solution than the one you marked &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; The next release of the JS API (4.20) seems to fix this issue + surprisingly, it's already reachable and available (not officially) through the esri-loader, so you can test it but I'd suggest "productionise" this only after the official release which should be in the next few weeks&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jun 2021 00:56:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1071799#M73606</guid>
      <dc:creator>shaylavi</dc:creator>
      <dc:date>2021-06-24T00:56:03Z</dc:date>
    </item>
    <item>
      <title>Re: React: Clicking on a Search widget suggestion does nothing ('select-result' event does not fire)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1073361#M73660</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/335589"&gt;@shaylavi&lt;/a&gt;Awesome, I'm happy to hear it will be fixed in the next release. Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jun 2021 18:04:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1073361#M73660</guid>
      <dc:creator>ShellyM</dc:creator>
      <dc:date>2021-06-28T18:04:04Z</dc:date>
    </item>
    <item>
      <title>Re: React: Clicking on a Search widget suggestion does nothing ('select-result' event does not fire)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1075392#M73725</link>
      <description>&lt;P&gt;For anyone who is still following this (or who may stumble upon this thread), I tried out version 4.20 and can confirm that the search widget is working. Switching to 4.20 also fixed some other issues I was having with the feature table widget. Can't wait for the official release &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Jul 2021 01:48:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/react-clicking-on-a-search-widget-suggestion-does/m-p/1075392#M73725</guid>
      <dc:creator>ShellyM</dc:creator>
      <dc:date>2021-07-03T01:48:21Z</dc:date>
    </item>
  </channel>
</rss>

