<?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: Arcgis Map Component dismount - an avalanche of destruction!? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-map-component-dismount-an-avalanche-of/m-p/1638291#M87456</link>
    <description>&lt;P&gt;Thanks Rene - that will simplify things considerably!&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 01 Aug 2025 09:03:20 GMT</pubDate>
    <dc:creator>JonathanDawe_BAS</dc:creator>
    <dc:date>2025-08-01T09:03:20Z</dc:date>
    <item>
      <title>Arcgis Map Component dismount - an avalanche of destruction!?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-map-component-dismount-an-avalanche-of/m-p/1637935#M87443</link>
      <description>&lt;P&gt;I’ve been using the &amp;lt;arcgis-map&amp;gt; component in a bunch of my React apps, and overall it works really well. But I’ve noticed something odd (and a bit frustrating) when the component is removed from the page.&lt;/P&gt;&lt;P&gt;Whenever the map component is unmounted or replaced, it calls the destroy method on the MapView. That makes sense on its own—but it also ends up destroying other ArcGIS API objects that I created separately, like Popup or FeatureLayer instances. Even though I created those outside of the component, they still get wiped out.&lt;/P&gt;&lt;P&gt;This has caused a few headaches. I often want to reuse things like a popup or a layer across multiple maps or views, kind of like singletons. But because the map component destroys them when it unmounts, I’m forced to recreate everything from scratch every time. That feels inefficient and makes my React code more complicated than it needs to be.&lt;/P&gt;&lt;P&gt;So I’m wondering:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;Is this expected behaviour?&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Is there a way to stop &amp;lt;arcgis-map&amp;gt; from destroying things I created outside of it?&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Or is there a better pattern for reusing API instances safely?&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Thanks in advance—keen to hear how others are handling this!&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jul 2025 10:44:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-map-component-dismount-an-avalanche-of/m-p/1637935#M87443</guid>
      <dc:creator>JonathanDawe_BAS</dc:creator>
      <dc:date>2025-07-31T10:44:35Z</dc:date>
    </item>
    <item>
      <title>Re: Arcgis Map Component dismount - an avalanche of destruction!?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-map-component-dismount-an-avalanche-of/m-p/1637943#M87444</link>
      <description>&lt;P&gt;Great question, as this has come up a couple of times.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Yes, this is expected. Lots of apps will remove and add elements to the page at runtime, and custom elements have a built in lifecycle method to handle what to do when that happens. If we didn't destroy everything, this would lead memory leaks.&lt;/LI&gt;&lt;LI&gt;Every map-component has an&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-map/#autoDestroyDisabled" target="_blank" rel="noopener"&gt;autoDestroyDisabled&lt;/A&gt; property you can set to disable this behavior. This is useful to maintain maps and layers that might be used in other places in your application. Note, that this now puts the responsibility of calling the component &lt;A href="https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-map/#destroy" target="_blank" rel="noopener"&gt;destroy method&lt;/A&gt; on the developer when they are done to prevent memory leaks.&lt;/LI&gt;&lt;LI&gt;Not necessarily. In the next release it should be easier to hide components via css classes if you want to avoid adding/removing them.&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Thu, 31 Jul 2025 11:56:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-map-component-dismount-an-avalanche-of/m-p/1637943#M87444</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2025-07-31T11:56:38Z</dc:date>
    </item>
    <item>
      <title>Re: Arcgis Map Component dismount - an avalanche of destruction!?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-map-component-dismount-an-avalanche-of/m-p/1638291#M87456</link>
      <description>&lt;P&gt;Thanks Rene - that will simplify things considerably!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Aug 2025 09:03:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-map-component-dismount-an-avalanche-of/m-p/1638291#M87456</guid>
      <dc:creator>JonathanDawe_BAS</dc:creator>
      <dc:date>2025-08-01T09:03:20Z</dc:date>
    </item>
  </channel>
</rss>

