<?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: Problem - SketchViewModel Create() fires Legend update in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-sketchviewmodel-create-fires-legend-update/m-p/78036#M7093</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have observed the same behavior. In my case, the Select tool and the Measure tool, both fire the function declared for 'listItemCreatedFunction'. Also, when the LayerList is created (for the first time), it executes &lt;SPAN&gt;the function declared for '&lt;/SPAN&gt;&lt;SPAN&gt;listItemCreatedFunction' 4 times. This even happens in the example for this feature in the Esri website (&lt;A class="link-titled" href="https://developers.arcgis.com/javascript/latest/sample-code/widgets-layerlist-actions/index.html" title="https://developers.arcgis.com/javascript/latest/sample-code/widgets-layerlist-actions/index.html"&gt;LayerList widget with actions | ArcGIS API for JavaScript 4.14&lt;/A&gt;&amp;nbsp;)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 11 Feb 2020 01:10:02 GMT</pubDate>
    <dc:creator>Jorge_LuisMonge_Blanco</dc:creator>
    <dc:date>2020-02-11T01:10:02Z</dc:date>
    <item>
      <title>Problem - SketchViewModel Create() fires Legend update</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-sketchviewmodel-create-fires-legend-update/m-p/78035#M7092</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My setup -&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Javascript api 4.13&lt;/LI&gt;&lt;LI&gt;I have around 40 layers.&amp;nbsp; Mainly MapImageLayers.&lt;/LI&gt;&lt;LI&gt;I use the LayerList widget and have added the Legend in a container. using&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-LayerList.html#listItemCreatedFunction" style="color: #0079c1; background-color: #ffffff; font-weight: 300; text-decoration: none;"&gt;listItemCreatedFunction&lt;/A&gt;.&lt;/LI&gt;&lt;LI&gt;Im using the SketchViewModel to create a Polygon, Point and Polyline tools.&amp;nbsp;&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;I have a Graphic Layer that the drawings go into, this is added to the view. but is hidden on the layer list&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My Problem.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;When i click on the Polygon tool which fires the create method of the sketchviewmodel.&amp;nbsp; I get around a 5-8 seconds lag before I can start drawing.&lt;/LI&gt;&lt;LI&gt;the lag disapears if i have the graphic layer hidden aswell as legend off.&amp;nbsp; if i do graphic visible in LayerList i get the lag even with legend off.&lt;/LI&gt;&lt;LI&gt;I found that when I click Create the layerlists listItemCreateFunction fires&amp;nbsp; as well as the legend update which then goes through and regrabs every layers legend again.&amp;nbsp; however this only fires if i have legend in the layerlist container with the GraphicLayer hidden.&lt;/LI&gt;&lt;LI&gt;Another stange thing which i dont know if its normal is that the listItemCreatedFunction runs 9 times (even on startup)&amp;nbsp; So if i put a watch on the listItemCreatedFunction and log the layers.&amp;nbsp; I see my 40 layers list out 9 times.&lt;UL&gt;&lt;LI&gt;I have checked and my operational layers are only there once.I dont have multiple instances of LayerList.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;The same issue happens on sketchviewmodel Complete.&amp;nbsp; So completing a polygon i get 8 second lag while the legend repopulates and the listItemCreatedFunction runs for all layers.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have made sure my legend isnt enabled for my graphic layer.&amp;nbsp; i cant understand why the legend is refreshing for all my layers.&lt;/P&gt;&lt;P&gt;I have also tried the Sketch widget.&amp;nbsp; It has the same lag.&lt;/P&gt;&lt;P&gt;Is there a way to disable that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My Code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following is in view.when:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var layerList = new LayerList({&lt;BR /&gt; view: view,&lt;BR /&gt; listItemCreatedFunction: defineActions&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;function defineActions(event) {&lt;/P&gt;&lt;P&gt;var item = event.item;&lt;BR /&gt; item.panel = {&lt;BR /&gt; content: "legend",&lt;BR /&gt; open: false&lt;BR /&gt; };&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here is where i tested the sketch widget that has the same lag&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var sketch = new Sketch({&lt;BR /&gt; layer: tmp_Cosmetic,&lt;BR /&gt; view: view&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;view.ui.add(sketch, "top-right");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tmp_Cosmetic is my graphic layer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Oct 2019 00:46:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-sketchviewmodel-create-fires-legend-update/m-p/78035#M7092</guid>
      <dc:creator>DavidDoyle</dc:creator>
      <dc:date>2019-10-14T00:46:45Z</dc:date>
    </item>
    <item>
      <title>Re: Problem - SketchViewModel Create() fires Legend update</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-sketchviewmodel-create-fires-legend-update/m-p/78036#M7093</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have observed the same behavior. In my case, the Select tool and the Measure tool, both fire the function declared for 'listItemCreatedFunction'. Also, when the LayerList is created (for the first time), it executes &lt;SPAN&gt;the function declared for '&lt;/SPAN&gt;&lt;SPAN&gt;listItemCreatedFunction' 4 times. This even happens in the example for this feature in the Esri website (&lt;A class="link-titled" href="https://developers.arcgis.com/javascript/latest/sample-code/widgets-layerlist-actions/index.html" title="https://developers.arcgis.com/javascript/latest/sample-code/widgets-layerlist-actions/index.html"&gt;LayerList widget with actions | ArcGIS API for JavaScript 4.14&lt;/A&gt;&amp;nbsp;)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Feb 2020 01:10:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-sketchviewmodel-create-fires-legend-update/m-p/78036#M7093</guid>
      <dc:creator>Jorge_LuisMonge_Blanco</dc:creator>
      <dc:date>2020-02-11T01:10:02Z</dc:date>
    </item>
    <item>
      <title>Re: Problem - SketchViewModel Create() fires Legend update</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-sketchviewmodel-create-fires-legend-update/m-p/1018506#M71448</link>
      <description>&lt;P&gt;Any update on this?&amp;nbsp; I believe I'm having the exact same problem.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2021 22:56:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-sketchviewmodel-create-fires-legend-update/m-p/1018506#M71448</guid>
      <dc:creator>NilsBabel1</dc:creator>
      <dc:date>2021-01-20T22:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: Problem - SketchViewModel Create() fires Legend update</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-sketchviewmodel-create-fires-legend-update/m-p/1057302#M73076</link>
      <description>&lt;P&gt;Any update on this?&amp;nbsp; I believe the issue is more pronounced in the 4.19 release.&amp;nbsp; I create a legend in the item panel of the layerlist with the list item created function.&amp;nbsp; I have multiple layers in my map and the performance is terrible.&amp;nbsp; As soon as I disable the legend the performance increases.&amp;nbsp; Sketch and measure tools work better too.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 May 2021 18:37:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-sketchviewmodel-create-fires-legend-update/m-p/1057302#M73076</guid>
      <dc:creator>NilsBabel1</dc:creator>
      <dc:date>2021-05-12T18:37:35Z</dc:date>
    </item>
  </channel>
</rss>

