<?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 calcite-components-react with Vite - errors during HMR in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calcite-components-react-with-vite-errors-during/m-p/1403725#M84168</link>
    <description>&lt;P&gt;I have a problem using calcite-components-react with Vite dev server in HMR mode. The components, when applying changes or even on initial load, seem to get duplicated.&lt;/P&gt;&lt;P&gt;For example, the layerlist as shown here:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AndresKasekamp_0-1711955457391.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/99584i315967BCB6B68C5D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AndresKasekamp_0-1711955457391.png" alt="AndresKasekamp_0-1711955457391.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AndresKasekamp_1-1711955618800.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/99586iE16EBE586EA2E495/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AndresKasekamp_1-1711955618800.png" alt="AndresKasekamp_1-1711955618800.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The current workaround is destroying the view with view.destroy() in useEffect cleanup, and then doing a full reload when changes are made, this at least assures that the components do not get duplicated, but it defeats the purpose of using HMR.&lt;/P&gt;&lt;P&gt;How it should look like:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AndresKasekamp_2-1711955679858.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/99587iF52B85C06B2CB7DC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AndresKasekamp_2-1711955679858.png" alt="AndresKasekamp_2-1711955679858.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;There are no problems in production build.&lt;/P&gt;&lt;P&gt;I have re-created a minimal example here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/AndresKasekamp/calcite-arcgis-hmr" target="_blank"&gt;https://github.com/AndresKasekamp/calcite-arcgis-hmr&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 01 Apr 2024 07:18:16 GMT</pubDate>
    <dc:creator>AndresKasekamp</dc:creator>
    <dc:date>2024-04-01T07:18:16Z</dc:date>
    <item>
      <title>calcite-components-react with Vite - errors during HMR</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calcite-components-react-with-vite-errors-during/m-p/1403725#M84168</link>
      <description>&lt;P&gt;I have a problem using calcite-components-react with Vite dev server in HMR mode. The components, when applying changes or even on initial load, seem to get duplicated.&lt;/P&gt;&lt;P&gt;For example, the layerlist as shown here:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AndresKasekamp_0-1711955457391.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/99584i315967BCB6B68C5D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AndresKasekamp_0-1711955457391.png" alt="AndresKasekamp_0-1711955457391.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AndresKasekamp_1-1711955618800.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/99586iE16EBE586EA2E495/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AndresKasekamp_1-1711955618800.png" alt="AndresKasekamp_1-1711955618800.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The current workaround is destroying the view with view.destroy() in useEffect cleanup, and then doing a full reload when changes are made, this at least assures that the components do not get duplicated, but it defeats the purpose of using HMR.&lt;/P&gt;&lt;P&gt;How it should look like:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AndresKasekamp_2-1711955679858.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/99587iF52B85C06B2CB7DC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AndresKasekamp_2-1711955679858.png" alt="AndresKasekamp_2-1711955679858.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;There are no problems in production build.&lt;/P&gt;&lt;P&gt;I have re-created a minimal example here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/AndresKasekamp/calcite-arcgis-hmr" target="_blank"&gt;https://github.com/AndresKasekamp/calcite-arcgis-hmr&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2024 07:18:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calcite-components-react-with-vite-errors-during/m-p/1403725#M84168</guid>
      <dc:creator>AndresKasekamp</dc:creator>
      <dc:date>2024-04-01T07:18:16Z</dc:date>
    </item>
    <item>
      <title>Re: calcite-components-react with Vite - errors during HMR</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calcite-components-react-with-vite-errors-during/m-p/1403736#M84171</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/49511"&gt;@AndresKasekamp&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hey, the reason is you are running you app in strict mode.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="imritanshu_0-1711963654373.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/99592iD6F6844584EF37FC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="imritanshu_0-1711963654373.png" alt="imritanshu_0-1711963654373.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;comment these lines and app should work fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also one more observation, every variable you are storing in state, which may cause issue as application will grow. Try state only where it is must. Else you can simply store values without state also.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if solution works please mark it as answer.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2024 09:29:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calcite-components-react-with-vite-errors-during/m-p/1403736#M84171</guid>
      <dc:creator>imritanshu</dc:creator>
      <dc:date>2024-04-01T09:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: calcite-components-react with Vite - errors during HMR</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calcite-components-react-with-vite-errors-during/m-p/1403747#M84172</link>
      <description>&lt;P&gt;Disabling StrictMode does not work.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2024 10:35:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calcite-components-react-with-vite-errors-during/m-p/1403747#M84172</guid>
      <dc:creator>AndresKasekamp</dc:creator>
      <dc:date>2024-04-01T10:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: calcite-components-react with Vite - errors during HMR</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calcite-components-react-with-vite-errors-during/m-p/1403749#M84173</link>
      <description>&lt;P&gt;Probably you are doing something wrong. I cloned your sample and commented the strict mode. It is working without any issue.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="imritanshu_0-1711968528934.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/99601i06DDF280411AACA0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="imritanshu_0-1711968528934.png" alt="imritanshu_0-1711968528934.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Have a look.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2024 10:49:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calcite-components-react-with-vite-errors-during/m-p/1403749#M84173</guid>
      <dc:creator>imritanshu</dc:creator>
      <dc:date>2024-04-01T10:49:05Z</dc:date>
    </item>
    <item>
      <title>Re: calcite-components-react with Vite - errors during HMR</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calcite-components-react-with-vite-errors-during/m-p/1403752#M84174</link>
      <description>&lt;P&gt;for your reference.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="imritanshu_1-1711968746183.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/99602i5E924D3452A66F56/image-size/medium?v=v2&amp;amp;px=400" role="button" title="imritanshu_1-1711968746183.png" alt="imritanshu_1-1711968746183.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://legacy.reactjs.org/docs/strict-mode.html#detecting-unexpected-side-effects" target="_blank"&gt;https://legacy.reactjs.org/docs/strict-mode.html#detecting-unexpected-side-effects&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2024 10:52:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calcite-components-react-with-vite-errors-during/m-p/1403752#M84174</guid>
      <dc:creator>imritanshu</dc:creator>
      <dc:date>2024-04-01T10:52:43Z</dc:date>
    </item>
    <item>
      <title>Re: calcite-components-react with Vite - errors during HMR</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calcite-components-react-with-vite-errors-during/m-p/1403756#M84175</link>
      <description>&lt;P&gt;The first render is okay, so it would be the same as calling view.destroy(). However, when you modify App.jsx file in any way with dev server running (comments, new line, imports, etc), then it will cause the components to behave &lt;SPAN&gt;unexpectedly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2024 11:06:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calcite-components-react-with-vite-errors-during/m-p/1403756#M84175</guid>
      <dc:creator>AndresKasekamp</dc:creator>
      <dc:date>2024-04-01T11:06:08Z</dc:date>
    </item>
    <item>
      <title>Re: calcite-components-react with Vite - errors during HMR</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calcite-components-react-with-vite-errors-during/m-p/1403879#M84178</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/49511"&gt;@AndresKasekamp&lt;/a&gt;&amp;nbsp; you'll need to do further testing by removing '@arcgis/core' functionality and calcite elements one-by-one to try and find the root cause. Otherwise there's too much going on in the sample including the calcite react wrapper, calcite-panel, calcite-shell, calcite-shell-panel and various '@arcgis/core' modules.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2024 15:40:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calcite-components-react-with-vite-errors-during/m-p/1403879#M84178</guid>
      <dc:creator>AndyGup</dc:creator>
      <dc:date>2024-04-01T15:40:52Z</dc:date>
    </item>
  </channel>
</rss>

