<?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 Connecting to Map and getting all the Layers in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/connecting-to-map-and-getting-all-the-layers/m-p/1507548#M85072</link>
    <description>&lt;P&gt;Hey, so I was working on a custom widget for Experience builder and my code was running perfectly fine up until yesterday, where it stopped being able to access the layers. This is the code:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const viewManager = MapViewManager.getInstance();
  const mapView = viewManager.getJimuMapViewById(viewManager.getAllJimuMapViewIds()[0])
  const [jimuMapView, setJimuMapView] = useState&amp;lt;JimuMapView&amp;gt;(mapView); // State for JimuMapView
  const [mapReady, setMapReady] = useState(false); // State to track map readiness

useEffect(() =&amp;gt; {
    if (jimuMapView) {
			reactiveUtils
				.whenOnce(() =&amp;gt; jimuMapView.view.ready)
				.then(() =&amp;gt; {
					setMapReady(true)
				}
				)
		}

	}, [jimuMapView])

return (
    &amp;lt;div className="widget-demo jimu-widget m-2"&amp;gt;
      {
				props.useMapWidgetIds &amp;amp;&amp;amp;
				props.useMapWidgetIds.length === 1 &amp;amp;&amp;amp; (
					&amp;lt;JimuMapViewComponent
						useMapWidgetId={props.useMapWidgetIds?.[0]}
						onActiveViewChange={activeViewChangeHandler}
					/&amp;gt;
				)
			}
      {mapReady ? 'Map ready' : 'Map not ready'}

    &amp;lt;/div&amp;gt;
  );
};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
    <pubDate>Sat, 20 Jul 2024 14:50:11 GMT</pubDate>
    <dc:creator>ShahranNewaz</dc:creator>
    <dc:date>2024-07-20T14:50:11Z</dc:date>
    <item>
      <title>Connecting to Map and getting all the Layers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/connecting-to-map-and-getting-all-the-layers/m-p/1507548#M85072</link>
      <description>&lt;P&gt;Hey, so I was working on a custom widget for Experience builder and my code was running perfectly fine up until yesterday, where it stopped being able to access the layers. This is the code:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const viewManager = MapViewManager.getInstance();
  const mapView = viewManager.getJimuMapViewById(viewManager.getAllJimuMapViewIds()[0])
  const [jimuMapView, setJimuMapView] = useState&amp;lt;JimuMapView&amp;gt;(mapView); // State for JimuMapView
  const [mapReady, setMapReady] = useState(false); // State to track map readiness

useEffect(() =&amp;gt; {
    if (jimuMapView) {
			reactiveUtils
				.whenOnce(() =&amp;gt; jimuMapView.view.ready)
				.then(() =&amp;gt; {
					setMapReady(true)
				}
				)
		}

	}, [jimuMapView])

return (
    &amp;lt;div className="widget-demo jimu-widget m-2"&amp;gt;
      {
				props.useMapWidgetIds &amp;amp;&amp;amp;
				props.useMapWidgetIds.length === 1 &amp;amp;&amp;amp; (
					&amp;lt;JimuMapViewComponent
						useMapWidgetId={props.useMapWidgetIds?.[0]}
						onActiveViewChange={activeViewChangeHandler}
					/&amp;gt;
				)
			}
      {mapReady ? 'Map ready' : 'Map not ready'}

    &amp;lt;/div&amp;gt;
  );
};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Sat, 20 Jul 2024 14:50:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/connecting-to-map-and-getting-all-the-layers/m-p/1507548#M85072</guid>
      <dc:creator>ShahranNewaz</dc:creator>
      <dc:date>2024-07-20T14:50:11Z</dc:date>
    </item>
  </channel>
</rss>

