<?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: Querying feature layer when it loads. in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/querying-feature-layer-when-it-loads/m-p/1167063#M77108</link>
    <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;What &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/2839"&gt;@KenBuja&lt;/a&gt;&amp;nbsp;said. If you are using version 4.23, then please use &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-core-reactiveUtils.html" target="_self"&gt;reactiveUtils&lt;/A&gt; instead of watchUtils.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// this will only run once after layerview finishes updating for the first time
view.whenLayerView(layer).then((layerView) =&amp;gt; {
   reactiveUtils.whenOnce(() =&amp;gt; !layerView.updating).then(() =&amp;gt; {
     console.log("layer finished updating");
   });
});&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 22 Apr 2022 15:46:55 GMT</pubDate>
    <dc:creator>UndralBatsukh</dc:creator>
    <dc:date>2022-04-22T15:46:55Z</dc:date>
    <item>
      <title>Querying feature layer when it loads.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/querying-feature-layer-when-it-loads/m-p/1166920#M77100</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I am trying to query my feature layer when it gets loaded. I found this method on the esri website:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;// returns all the graphics from the layer view&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;view.whenLayerView(layer).then(function(layerView){&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;layerView.watch("updating", function(val){&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;if(!val){ // wait for the layer view to finish updating&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;layerView.queryFeatures().then(function(results){&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;console.log(results); // prints all the client-side features to the console&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;});&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;});&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;});&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this queries through all the features everytime layer gets updated(like dragging, zooming etc.). I just want to query once when it gets loaded. Can someone please help me out with this?&lt;/P&gt;&lt;P&gt;Thanks in advanced&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2022 06:10:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/querying-feature-layer-when-it-loads/m-p/1166920#M77100</guid>
      <dc:creator>YogeshSwami</dc:creator>
      <dc:date>2022-04-22T06:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: Querying feature layer when it loads.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/querying-feature-layer-when-it-loads/m-p/1166966#M77104</link>
      <description>&lt;P&gt;Take a look at this useful &lt;A href="https://odoe.net/blog/when-are-layers-done" target="_self"&gt;blog&lt;/A&gt; by &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/7384"&gt;@ReneRubalcava&lt;/a&gt; about doing things when a layer loads.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;PRE&gt;async function whenDone() {
  const layerView = await view.whenLayerView(featureLayer);
  await watchUtils.whenFalseOnce(layerView, 'updating');
  console.log('layerView is done loading and drawing', layerView);
}&lt;/PRE&gt;&lt;P&gt;Most of the time, I'm interested in just the first time the layer loads in an application, so I use &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-core-watchUtils.html#whenFalseOnce" target="_blank" rel="nofollow noopener"&gt;whenFalseOnce&lt;/A&gt; of the watchUtils to check the first time it happens. If you are interested in every time the LayerView is done updating, you could use &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-core-watchUtils.html#whenFalse" target="_blank" rel="nofollow noopener"&gt;whenFalse&lt;/A&gt; to keep an eye on it.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2022 12:28:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/querying-feature-layer-when-it-loads/m-p/1166966#M77104</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2022-04-22T12:28:26Z</dc:date>
    </item>
    <item>
      <title>Re: Querying feature layer when it loads.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/querying-feature-layer-when-it-loads/m-p/1167063#M77108</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;What &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/2839"&gt;@KenBuja&lt;/a&gt;&amp;nbsp;said. If you are using version 4.23, then please use &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-core-reactiveUtils.html" target="_self"&gt;reactiveUtils&lt;/A&gt; instead of watchUtils.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// this will only run once after layerview finishes updating for the first time
view.whenLayerView(layer).then((layerView) =&amp;gt; {
   reactiveUtils.whenOnce(() =&amp;gt; !layerView.updating).then(() =&amp;gt; {
     console.log("layer finished updating");
   });
});&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 22 Apr 2022 15:46:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/querying-feature-layer-when-it-loads/m-p/1167063#M77108</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2022-04-22T15:46:55Z</dc:date>
    </item>
  </channel>
</rss>

