<?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: Unable to extend FeatureLayer at 4.16 in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unable-to-extend-featurelayer-at-4-16/m-p/1026981#M71778</link>
    <description>&lt;P&gt;(Edit)&lt;/P&gt;</description>
    <pubDate>Mon, 15 Feb 2021 22:07:48 GMT</pubDate>
    <dc:creator>Maka</dc:creator>
    <dc:date>2021-02-15T22:07:48Z</dc:date>
    <item>
      <title>Unable to extend FeatureLayer at 4.16</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unable-to-extend-featurelayer-at-4-16/m-p/705029#M65606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;At 4.16, extending the FeatureLayer no longer works. We have a feature layer where we set the source property in the constructor to generate some graphics on the client side. For this layer in particular, we extended FeatureLayer to add&amp;nbsp;a few helper methods that lets us talk to our internal API.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At 4.15, this worked as expected, however at&amp;nbsp;4.16, we now get an error: "Feature layer must be created with either a url or a source". Inspecting the output, the source property is undefined so at some point along the line the constructor is failing if the class extended.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Codepen Example:&amp;nbsp;&lt;A href="https://codepen.io/tatkins/pen/JjGQYqp" title="https://codepen.io/tatkins/pen/JjGQYqp" rel="nofollow noopener noreferrer" target="_blank"&gt;https://codepen.io/tatkins/pen/JjGQYqp&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just swap from 4.16 to 4.15 in the api url and the layer will work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example:&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="keyword token"&gt;class&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;ExtendedLayer&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;extends&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;FeatureLayer&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  &lt;SPAN class="token function"&gt;constructor&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;props&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;super&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;props&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="punctuation token"&gt;}&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;const&lt;/SPAN&gt; layer &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;new&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;ExtendedLayer&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="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="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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;At 4.16 this will fail but will work correctly at 4.15.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any insight is appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:38:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unable-to-extend-featurelayer-at-4-16/m-p/705029#M65606</guid>
      <dc:creator>ToddAtkins</dc:creator>
      <dc:date>2021-12-12T05:38:08Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to extend FeatureLayer at 4.16</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unable-to-extend-featurelayer-at-4-16/m-p/705030#M65607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm sorry your are running into this. API Classes moved away from `dojo/_base/declare` and internals have changed. We never supported extending classes using native ES classes, and it worked by chance. We&amp;nbsp;might support it at some point, after more refactoring, but it's not immediate work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See&amp;nbsp;&lt;A class="link-titled" href="https://developers.arcgis.com/javascript/latest/guide/implementing-accessor/#create-a-simple-subclass" title="https://developers.arcgis.com/javascript/latest/guide/implementing-accessor/#create-a-simple-subclass" rel="nofollow noopener noreferrer" target="_blank"&gt;Implementing Accessor | ArcGIS API for JavaScript 4.16&lt;/A&gt;&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="keyword token"&gt;const&lt;/SPAN&gt; ExtendedFeatureLayer &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; FeatureLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;createSubclass&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  &lt;SPAN class="token function"&gt;additionalMethod&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="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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can make it work with ES classes, but this is not supported and will likely change in the future&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="keyword token"&gt;class&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;ExtendedLayer&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;extends&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;FeatureLayer&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  &lt;SPAN class="token function"&gt;constructor&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;props&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;super&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;props&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;&lt;SPAN class="token function"&gt;postscript&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="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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:38:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unable-to-extend-featurelayer-at-4-16/m-p/705030#M65607</guid>
      <dc:creator>YannCabon</dc:creator>
      <dc:date>2021-12-12T05:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to extend FeatureLayer at 4.16</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unable-to-extend-featurelayer-at-4-16/m-p/705031#M65608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah, I didn't know that about the ES classes and the Esri API.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm having a look at the Accessor stuff in there but haven't had a lot of success yet. Maybe because I'm using esri-loader in this project (it's a create-react-app project). I'll fiddle with it some more and see if I can get it to work this way, otherwise I can refactor the code and workaround it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jul 2020 20:37:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unable-to-extend-featurelayer-at-4-16/m-p/705031#M65608</guid>
      <dc:creator>ToddAtkins</dc:creator>
      <dc:date>2020-07-29T20:37:28Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to extend FeatureLayer at 4.16</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unable-to-extend-featurelayer-at-4-16/m-p/1026981#M71778</link>
      <description>&lt;P&gt;(Edit)&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2021 22:07:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unable-to-extend-featurelayer-at-4-16/m-p/1026981#M71778</guid>
      <dc:creator>Maka</dc:creator>
      <dc:date>2021-02-15T22:07:48Z</dc:date>
    </item>
  </channel>
</rss>

