<?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 Uncaught TypeError: Cannot read properties of null (reading '0') in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uncaught-typeerror-cannot-read-properties-of-null/m-p/1308447#M81700</link>
    <description>&lt;DIV&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;I am trying to query features from the feature layer view and add these features to a graphics layer to enable snapping on the features using the sketch view model I already have, but on a large scale, i start to see this error: " Uncaught TypeError: Cannot read properties of null (reading '0') ".&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;BLOCKQUOTE&gt;NOTE: when I comment : "&amp;nbsp;gfxLayer.add(g) " or&amp;nbsp; "&amp;nbsp;new FeatureSnappingLayerSource({&amp;nbsp;layer: gfxLayer as __esri.GraphicsLayer,&amp;nbsp;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;&lt;BLOCKQUOTE&gt;enabled: true,&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;&lt;BLOCKQUOTE&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}), "&amp;nbsp; or " visible: false," I don't see the error anymore, but snapping does not work.&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;&lt;BLOCKQUOTE&gt;any thoughts?&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;&lt;BLOCKQUOTE&gt;&amp;nbsp;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;sketchVmRef.current = new SketchViewModel({
        view: mapView,
        layer: new GraphicsLayer({}),
        snappingOptions: {
          enabled: true,
          featureSources: [
             new FeatureSnappingLayerSource({
               layer: gfxLayer as __esri.GraphicsLayer,
               enabled: true,
             }),
          ],
        },
      })
    
const queriedFeatures = await featureLayerView.queryFeatures({
          where: `1=1`,
          outFields: ['*'],
          returnGeometry: true,
        })
       
        for (const feature of queriedFeatures.features) {
          
            const g = new Graphic({
              geometry: feature.geometry,
              attributes: feature.attributes,
              layer: gfxLayer,
              // visible: false,
            })
            gfxLayer.add(g)

        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 16 Jul 2023 11:48:43 GMT</pubDate>
    <dc:creator>siefaqel</dc:creator>
    <dc:date>2023-07-16T11:48:43Z</dc:date>
    <item>
      <title>Uncaught TypeError: Cannot read properties of null (reading '0')</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uncaught-typeerror-cannot-read-properties-of-null/m-p/1308447#M81700</link>
      <description>&lt;DIV&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;I am trying to query features from the feature layer view and add these features to a graphics layer to enable snapping on the features using the sketch view model I already have, but on a large scale, i start to see this error: " Uncaught TypeError: Cannot read properties of null (reading '0') ".&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;BLOCKQUOTE&gt;NOTE: when I comment : "&amp;nbsp;gfxLayer.add(g) " or&amp;nbsp; "&amp;nbsp;new FeatureSnappingLayerSource({&amp;nbsp;layer: gfxLayer as __esri.GraphicsLayer,&amp;nbsp;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;&lt;BLOCKQUOTE&gt;enabled: true,&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;&lt;BLOCKQUOTE&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}), "&amp;nbsp; or " visible: false," I don't see the error anymore, but snapping does not work.&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;&lt;BLOCKQUOTE&gt;any thoughts?&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;&lt;BLOCKQUOTE&gt;&amp;nbsp;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;sketchVmRef.current = new SketchViewModel({
        view: mapView,
        layer: new GraphicsLayer({}),
        snappingOptions: {
          enabled: true,
          featureSources: [
             new FeatureSnappingLayerSource({
               layer: gfxLayer as __esri.GraphicsLayer,
               enabled: true,
             }),
          ],
        },
      })
    
const queriedFeatures = await featureLayerView.queryFeatures({
          where: `1=1`,
          outFields: ['*'],
          returnGeometry: true,
        })
       
        for (const feature of queriedFeatures.features) {
          
            const g = new Graphic({
              geometry: feature.geometry,
              attributes: feature.attributes,
              layer: gfxLayer,
              // visible: false,
            })
            gfxLayer.add(g)

        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Jul 2023 11:48:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uncaught-typeerror-cannot-read-properties-of-null/m-p/1308447#M81700</guid>
      <dc:creator>siefaqel</dc:creator>
      <dc:date>2023-07-16T11:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: Uncaught TypeError: Cannot read properties of null (reading '0')</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uncaught-typeerror-cannot-read-properties-of-null/m-p/1308765#M81710</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not able to reproduce the behavior you describe. Would you mind creating a simple reproducible case? You can use this codepen as starting point:&amp;nbsp;&lt;A href="https://codepen.io/U_B_U/pen/BaGxBqK?editors=100" target="_blank"&gt;https://codepen.io/U_B_U/pen/BaGxBqK?editors=100&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2023 19:32:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uncaught-typeerror-cannot-read-properties-of-null/m-p/1308765#M81710</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2023-07-17T19:32:16Z</dc:date>
    </item>
    <item>
      <title>Re: Uncaught TypeError: Cannot read properties of null (reading '0')</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uncaught-typeerror-cannot-read-properties-of-null/m-p/1309842#M81739</link>
      <description>&lt;P&gt;The error appears to be driven by your implementation of "gfxLayer".&amp;nbsp; Can you provide more code as it relates to that object (i.e. its construction, setting of properties, etc)?&lt;/P&gt;&lt;P&gt;I encountered this same error message yesterday, although it's unlikely we had the same problem.&amp;nbsp; The error message occurs when an Array is expected, but a value of null is received.&amp;nbsp; In my case, I was trying to use a &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-UniqueValueRenderer.html" target="_self"&gt;UniqueValueRenderer&lt;/A&gt; created from JSON with the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-UniqueValueRenderer.html#uniqueValueGroups" target="_self"&gt;uniqueValueGroups&lt;/A&gt; specified.&amp;nbsp; The JSON structure for uniqueValueGroups differs from the autocast structure, and is &lt;A href="https://community.esri.com/t5/arcgis-javascript-maps-sdk-blog/arcgis-api-for-javascript-4-25-and-3-42/bc-p/1234742/highlight/true#M198" target="_self"&gt;still undocumented&lt;/A&gt;, but I fumbled my way through it.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2023 22:56:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uncaught-typeerror-cannot-read-properties-of-null/m-p/1309842#M81739</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2023-07-19T22:56:37Z</dc:date>
    </item>
  </channel>
</rss>

