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 a few helper methods that lets us talk to our internal API.
At 4.15, this worked as expected, however at 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.
Codepen Example: https://codepen.io/tatkins/pen/JjGQYqp
Just swap from 4.16 to 4.15 in the api url and the layer will work.
For example:
<SPAN class="keyword token">class</SPAN> <SPAN class="token class-name">ExtendedLayer</SPAN> <SPAN class="keyword token">extends</SPAN> <SPAN class="token class-name">FeatureLayer</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="token function">constructor</SPAN><SPAN class="punctuation token">(</SPAN>props<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">super</SPAN><SPAN class="punctuation token">(</SPAN>props<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="keyword token">const</SPAN> layer <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">ExtendedLayer</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">{</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>At 4.16 this will fail but will work correctly at 4.15.
Any insight is appreciated.