<?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 Widget renders twice (1.1 ExB Dev) in ArcGIS Experience Builder Questions</title>
    <link>https://community.esri.com/t5/arcgis-experience-builder-questions/widget-renders-twice-1-1-exb-dev/m-p/524340#M827</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Boilerplate widgets (Simple, &lt;A href="https://github.com/Esri/arcgis-experience-builder-sdk-resources/tree/master/samples/widgets/editor" rel="nofollow noopener noreferrer" target="_blank"&gt;Editor&lt;/A&gt;) are called twice. According to various &lt;A href="https://medium.com/@andreasheissenberger/react-components-render-twice-any-way-to-fix-this-91cf23961625" rel="nofollow noopener noreferrer" target="_blank"&gt;write ups&lt;/A&gt;&amp;nbsp;this is due to React.StrictMode and is expected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="color: #24292e; background-color: #ffffff;"&gt;&lt;A href="https://github.com/facebook/react/issues/15074#issuecomment-471197572" rel="nofollow noopener noreferrer" target="_blank"&gt;It's an intentional feature of the StrictMode. This only happens in development, and helps find accidental side effects put into the render phase.&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd expect this shouldn't happen in a published app, but it does. Here is a raw copy of the&amp;nbsp;Simple widget. "here" hits the console twice in a published app.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;  &lt;SPAN class="token function"&gt;render&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;
      &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;div className&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"widget-demo jimu-widget m-2"&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;
        &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;p&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;Simple Widget&lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt;p&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;
            &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;p&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;exampleConfigProperty&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;props&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;config&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;exampleConfigProperty&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt;p&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;
            &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;console&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;log&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"here"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
      &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt;div&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this a bug? If not, how might I avoid my widget rendering twice?&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 22:51:29 GMT</pubDate>
    <dc:creator>PhilLarkin1</dc:creator>
    <dc:date>2021-12-11T22:51:29Z</dc:date>
    <item>
      <title>Widget renders twice (1.1 ExB Dev)</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/widget-renders-twice-1-1-exb-dev/m-p/524340#M827</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Boilerplate widgets (Simple, &lt;A href="https://github.com/Esri/arcgis-experience-builder-sdk-resources/tree/master/samples/widgets/editor" rel="nofollow noopener noreferrer" target="_blank"&gt;Editor&lt;/A&gt;) are called twice. According to various &lt;A href="https://medium.com/@andreasheissenberger/react-components-render-twice-any-way-to-fix-this-91cf23961625" rel="nofollow noopener noreferrer" target="_blank"&gt;write ups&lt;/A&gt;&amp;nbsp;this is due to React.StrictMode and is expected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="color: #24292e; background-color: #ffffff;"&gt;&lt;A href="https://github.com/facebook/react/issues/15074#issuecomment-471197572" rel="nofollow noopener noreferrer" target="_blank"&gt;It's an intentional feature of the StrictMode. This only happens in development, and helps find accidental side effects put into the render phase.&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd expect this shouldn't happen in a published app, but it does. Here is a raw copy of the&amp;nbsp;Simple widget. "here" hits the console twice in a published app.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;  &lt;SPAN class="token function"&gt;render&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;
      &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;div className&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"widget-demo jimu-widget m-2"&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;
        &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;p&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;Simple Widget&lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt;p&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;
            &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;p&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;exampleConfigProperty&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;props&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;config&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;exampleConfigProperty&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt;p&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;
            &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;console&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;log&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"here"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
      &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt;div&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this a bug? If not, how might I avoid my widget rendering twice?&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:51:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/widget-renders-twice-1-1-exb-dev/m-p/524340#M827</guid>
      <dc:creator>PhilLarkin1</dc:creator>
      <dc:date>2021-12-11T22:51:29Z</dc:date>
    </item>
    <item>
      <title>Re: Widget renders twice (1.1 ExB Dev)</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/widget-renders-twice-1-1-exb-dev/m-p/524341#M828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Would someone from the Experience Builder team please chime in here? &lt;SPAN&gt;This is easy to replicate.&amp;nbsp;&lt;/SPAN&gt;Since this issue is present in the broader React community it seems a simple workaround might be available.&amp;nbsp; &lt;A href="https://community.esri.com/migrated-users/55346"&gt;David Martinez&lt;/A&gt;‌ , &lt;A href="https://community.esri.com/migrated-users/44829"&gt;Jianxia Song&lt;/A&gt;‌ ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Sep 2020 16:45:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/widget-renders-twice-1-1-exb-dev/m-p/524341#M828</guid>
      <dc:creator>PhilLarkin1</dc:creator>
      <dc:date>2020-09-22T16:45:28Z</dc:date>
    </item>
    <item>
      <title>Re: Widget renders twice (1.1 ExB Dev)</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/widget-renders-twice-1-1-exb-dev/m-p/524342#M829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Phil,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for letting us know. We are looking into this now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Sep 2020 20:15:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/widget-renders-twice-1-1-exb-dev/m-p/524342#M829</guid>
      <dc:creator>DavidMartinez</dc:creator>
      <dc:date>2020-09-22T20:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: Widget renders twice (1.1 ExB Dev)</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/widget-renders-twice-1-1-exb-dev/m-p/524343#M830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks David, I appreciate it.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Sep 2020 23:44:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/widget-renders-twice-1-1-exb-dev/m-p/524343#M830</guid>
      <dc:creator>PhilLarkin1</dc:creator>
      <dc:date>2020-09-22T23:44:04Z</dc:date>
    </item>
    <item>
      <title>Re: Widget renders twice (1.1 ExB Dev)</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/widget-renders-twice-1-1-exb-dev/m-p/524344#M831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Phil,&lt;/P&gt;&lt;P&gt;We don't use&amp;nbsp;StrictMode and I don't see multiple times render if you modify the state.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The reason why you see multiple times render I think is: Widget is injected some props (you can see it from this.props), so if any prop change, the widget will re-render.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Sep 2020 01:23:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/widget-renders-twice-1-1-exb-dev/m-p/524344#M831</guid>
      <dc:creator>JunshanLiu</dc:creator>
      <dc:date>2020-09-23T01:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: Widget renders twice (1.1 ExB Dev)</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/widget-renders-twice-1-1-exb-dev/m-p/524345#M832</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Junshan, thanks for your reply.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For clarity I'd like to share how this can be replicated:&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;From a clean install, copy ..\client\your-extensions\widgets\simple&lt;/LI&gt;&lt;LI&gt;Paste to ..\client\dist\widgets&lt;/LI&gt;&lt;LI&gt;Launch builder and copy widget into Experience&lt;/LI&gt;&lt;LI&gt;Modify render or return functions to write to console. (console.log("test"))&lt;/LI&gt;&lt;LI&gt;Launch Experience and open Dev Tools console.&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;Click Simple Widget: console will show "test"&lt;/LI&gt;&lt;LI&gt;Close Simple Widget&lt;/LI&gt;&lt;LI&gt;Open Simple Widget: console will show "test" twice.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any way I can avoid this behavior? You mention that when a prop changes this will cause the widget to re-render. In this example I am not changing state or props and yet after the initial load of the widget it is rendered twice.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Sep 2020 17:24:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/widget-renders-twice-1-1-exb-dev/m-p/524345#M832</guid>
      <dc:creator>PhilLarkin1</dc:creator>
      <dc:date>2020-09-23T17:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: Widget renders twice (1.1 ExB Dev)</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/widget-renders-twice-1-1-exb-dev/m-p/524346#M833</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Phil,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tested it with version 1.1:&lt;/P&gt;&lt;P&gt;If&amp;nbsp;you add the simple widget to a controller widget, and when you open the simple widget the second time (not the first time), render is actually executed twice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This bug has been fixed in the latest version.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Sep 2020 06:55:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/widget-renders-twice-1-1-exb-dev/m-p/524346#M833</guid>
      <dc:creator>MingyangHan</dc:creator>
      <dc:date>2020-09-24T06:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: Widget renders twice (1.1 ExB Dev)</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/widget-renders-twice-1-1-exb-dev/m-p/524347#M834</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great, thank you for your help.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Sep 2020 14:57:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/widget-renders-twice-1-1-exb-dev/m-p/524347#M834</guid>
      <dc:creator>PhilLarkin1</dc:creator>
      <dc:date>2020-09-24T14:57:21Z</dc:date>
    </item>
  </channel>
</rss>

