<?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 componentOnReady() of Legend map componenet was not observed in v4.33 and 4.34 in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/componentonready-of-legend-map-componenet-was-not/m-p/1666433#M87884</link>
    <description>&lt;P&gt;For JS API 4.33 and 4.34&lt;/P&gt;&lt;P&gt;I have notice that the componentOnReady() function for map legend component was not observed during runtime.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt; let arcgisMap = document.querySelector('arcgis-map');
 let widget = document.createElement('arcgis-legend');

 arcgisMap.appendChild(widget);
 await widget.componentOnReady();

 console.log(arcgisMap.querySelector('.arcgis-legend'));&lt;/LI-CODE&gt;&lt;P&gt;`.arcgis-legend` class is one of the style class names used for the rendered legend component element structure.&lt;/P&gt;&lt;P&gt;When monitoring code executing in the web browser's dev console, if you set breakpoints on lines 5 and 7, you will see that when execution is halted on line 7, the legend component has not yet been constructed, even though the component has supposedly reached ready state according to line 5. Is this a bug?&lt;/P&gt;</description>
    <pubDate>Mon, 17 Nov 2025 19:27:03 GMT</pubDate>
    <dc:creator>AllenHuang</dc:creator>
    <dc:date>2025-11-17T19:27:03Z</dc:date>
    <item>
      <title>componentOnReady() of Legend map componenet was not observed in v4.33 and 4.34</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/componentonready-of-legend-map-componenet-was-not/m-p/1666433#M87884</link>
      <description>&lt;P&gt;For JS API 4.33 and 4.34&lt;/P&gt;&lt;P&gt;I have notice that the componentOnReady() function for map legend component was not observed during runtime.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt; let arcgisMap = document.querySelector('arcgis-map');
 let widget = document.createElement('arcgis-legend');

 arcgisMap.appendChild(widget);
 await widget.componentOnReady();

 console.log(arcgisMap.querySelector('.arcgis-legend'));&lt;/LI-CODE&gt;&lt;P&gt;`.arcgis-legend` class is one of the style class names used for the rendered legend component element structure.&lt;/P&gt;&lt;P&gt;When monitoring code executing in the web browser's dev console, if you set breakpoints on lines 5 and 7, you will see that when execution is halted on line 7, the legend component has not yet been constructed, even though the component has supposedly reached ready state according to line 5. Is this a bug?&lt;/P&gt;</description>
      <pubDate>Mon, 17 Nov 2025 19:27:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/componentonready-of-legend-map-componenet-was-not/m-p/1666433#M87884</guid>
      <dc:creator>AllenHuang</dc:creator>
      <dc:date>2025-11-17T19:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: componentOnReady() of Legend map componenet was not observed in v4.33 and 4.34</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/componentonready-of-legend-map-componenet-was-not/m-p/1666543#M87887</link>
      <description>&lt;P&gt;In 4.33, the selector is still `.esri-legend`. And in this case, `componentOnReady` only means the component code has loaded and properties/methods of the component are available to access. It doesn't mean that the data for the legend to get created is loaded. You can use the `arcgisReady` event of the legend if you want to do this in 4.33.&lt;/P&gt;&lt;P&gt;In 4.34 there is a `arcgis-legend` class, but it's in the &lt;A href="https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot" target="_blank" rel="noopener"&gt;shadowRoot&lt;/A&gt; and can't be queried via conventional means. So that won't work.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Nov 2025 23:03:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/componentonready-of-legend-map-componenet-was-not/m-p/1666543#M87887</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2025-11-17T23:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: componentOnReady() of Legend map componenet was not observed in v4.33 and 4.34</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/componentonready-of-legend-map-componenet-was-not/m-p/1666664#M87891</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/7384"&gt;@ReneRubalcava&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for responding so quickly. Thank you for correcting me on the class name. I am aware that the rendered component uses&lt;FONT color="#FF6600"&gt; .esri-legend&lt;/FONT&gt;. I've been working with other components some of them uses &lt;FONT color="#FF6600"&gt;.arcgis-&amp;lt;component_name&amp;gt;&lt;/FONT&gt; naming scheme, I got them mix up in this post.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, to your point, where &lt;SPAN&gt;`componentOnReady` validates the component code and properties have been loaded, that doesn't seem to be the case.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AllenHuang_1-1763469284210.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/143981i4624A77A8B791447/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AllenHuang_1-1763469284210.png" alt="AllenHuang_1-1763469284210.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The image above shows the real time capture where I stopped the map rendering after execution waited for componentOnReady() to complete. As you can see, at this point, the component should have been loaded and I should be able to capture an element with the &lt;FONT color="#FF6600"&gt;.esri-legend&lt;/FONT&gt; class name. But only &lt;FONT color="#99CC00"&gt;null&lt;/FONT&gt;&amp;nbsp;value returned in this case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The other component I've been working with and uses this exact code is the &lt;FONT color="#FF6600"&gt;arcig-print&lt;/FONT&gt; component.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AllenHuang_2-1763469822700.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/143982i608F15C6AB1EB887/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AllenHuang_2-1763469822700.png" alt="AllenHuang_2-1763469822700.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;As you can see here, after&amp;nbsp;&lt;SPAN&gt;componentOnReady() has finished executing,&amp;nbsp;&lt;/SPAN&gt;while there is no data as mentioned, the component DOM element of &lt;FONT color="#FF6600"&gt;arcgis-print&lt;/FONT&gt; has been loaded into the map in this case.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have also tried event listening with the&amp;nbsp;&lt;SPAN&gt;&lt;FONT color="#FF6600"&gt;arcgisReady&lt;/FONT&gt; event. Same issue here. It would seem that in both&amp;nbsp;&lt;FONT color="#FF6600"&gt;componentOnReady ()&lt;/FONT&gt; and &lt;FONT color="#FF6600"&gt;arcgisReady&lt;/FONT&gt;, arcgis-legend only loads after map itself has completely rendered.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Nov 2025 13:04:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/componentonready-of-legend-map-componenet-was-not/m-p/1666664#M87891</guid>
      <dc:creator>AllenHuang</dc:creator>
      <dc:date>2025-11-18T13:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: componentOnReady() of Legend map componenet was not observed in v4.33 and 4.34</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/componentonready-of-legend-map-componenet-was-not/m-p/1667101#M87898</link>
      <description>&lt;P&gt;Ah, I see. Yeah, the legend needs to wait for the map to load before it hydrates all children components.&lt;/P&gt;&lt;P&gt;In this case, it's more appropriate to wait for &lt;A href="https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-map/#viewOnReady" target="_blank" rel="noopener"&gt;mapElement.viewOnReady()&lt;/A&gt; or listen for the map elements &lt;A href="https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-map/#arcgisViewReadyChange" target="_blank" rel="noopener"&gt;arcgisViewReadyChange&lt;/A&gt;&amp;nbsp; event.&lt;/P&gt;&lt;P&gt;The components arcgisReady event just let's you know it now has a view, not that the view is ready.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Nov 2025 13:25:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/componentonready-of-legend-map-componenet-was-not/m-p/1667101#M87898</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2025-11-19T13:25:03Z</dc:date>
    </item>
  </channel>
</rss>

