<?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 Error Destroying FeatureTable instance during React cleanup action in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/error-destroying-featuretable-instance-during/m-p/1195783#M78060</link>
    <description>&lt;P&gt;In my React app development, I encountered the following error when destroying the FeatureTable instance as a cleanup action. Any recommendation is appreciated.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;Uncaught TypeError: Cannot set properties of null (setting 'selectedItems')
    at l11._clearSelection (Grid.js:959:7594)
    at l11.clearSelection (Grid.js:959:3594)
    at l11.clearSelection (FeatureTableViewModel.js:5:3924)
    at l11.destroy (FeatureTable.js:5:3158)
    at l11.value (subclass.js:5:998)
    at App.jsx:38:20
    at safelyCallDestroy (react-dom.development.js:22932:5)
    at commitHookEffectListUnmount (react-dom.development.js:23100:11)
    at invokePassiveEffectUnmountInDEV (react-dom.development.js:25207:13)
    at invokeEffectsInDev (react-dom.development.js:27351:11)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You may refer to the React app source code below:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;import FeatureLayer from "@arcgis/core/layers/FeatureLayer";
import Map from "@arcgis/core/Map";
import Mapview from "@arcgis/core/views/MapView";
import FeatureTable from "@arcgis/core/widgets/FeatureTable";
import { useEffect, useRef } from "react";
import "./App.css";

function App() {
  const viewRef = useRef();
  const tableRef = useRef();

  useEffect(() =&amp;gt; {
    const featureLayer = new FeatureLayer({
      url: "https://services2.arcgis.com/GrCObcYo81O3Ymu8/arcgis/rest/services/HDB_Car_Park_Location/FeatureServer/0",
      outFields: ["*"],
    });

    const map = new Map({
      basemap: "topo-vector",
      layers: [featureLayer],
    });

    const view = new Mapview({
      container: viewRef.current,
      map,
      center: [103.78, 1.34],
      zoom: 11,
    });

    const featureTable = new FeatureTable({
      view,
      layer: featureLayer,
      container: tableRef.current,
      editingEnabled: true,
    });

    return () =&amp;gt; {
      featureTable.destroy();
      view.destroy();
    };
  }, []);

  return (
    &amp;lt;div className="App"&amp;gt;
      &amp;lt;div id="viewDiv" ref={viewRef}&amp;gt;&amp;lt;/div&amp;gt;
      &amp;lt;div id="tableDiv" ref={tableRef}&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}

export default App;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 26 Jul 2022 08:22:09 GMT</pubDate>
    <dc:creator>WongChunKang</dc:creator>
    <dc:date>2022-07-26T08:22:09Z</dc:date>
    <item>
      <title>Error Destroying FeatureTable instance during React cleanup action</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/error-destroying-featuretable-instance-during/m-p/1195783#M78060</link>
      <description>&lt;P&gt;In my React app development, I encountered the following error when destroying the FeatureTable instance as a cleanup action. Any recommendation is appreciated.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;Uncaught TypeError: Cannot set properties of null (setting 'selectedItems')
    at l11._clearSelection (Grid.js:959:7594)
    at l11.clearSelection (Grid.js:959:3594)
    at l11.clearSelection (FeatureTableViewModel.js:5:3924)
    at l11.destroy (FeatureTable.js:5:3158)
    at l11.value (subclass.js:5:998)
    at App.jsx:38:20
    at safelyCallDestroy (react-dom.development.js:22932:5)
    at commitHookEffectListUnmount (react-dom.development.js:23100:11)
    at invokePassiveEffectUnmountInDEV (react-dom.development.js:25207:13)
    at invokeEffectsInDev (react-dom.development.js:27351:11)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You may refer to the React app source code below:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;import FeatureLayer from "@arcgis/core/layers/FeatureLayer";
import Map from "@arcgis/core/Map";
import Mapview from "@arcgis/core/views/MapView";
import FeatureTable from "@arcgis/core/widgets/FeatureTable";
import { useEffect, useRef } from "react";
import "./App.css";

function App() {
  const viewRef = useRef();
  const tableRef = useRef();

  useEffect(() =&amp;gt; {
    const featureLayer = new FeatureLayer({
      url: "https://services2.arcgis.com/GrCObcYo81O3Ymu8/arcgis/rest/services/HDB_Car_Park_Location/FeatureServer/0",
      outFields: ["*"],
    });

    const map = new Map({
      basemap: "topo-vector",
      layers: [featureLayer],
    });

    const view = new Mapview({
      container: viewRef.current,
      map,
      center: [103.78, 1.34],
      zoom: 11,
    });

    const featureTable = new FeatureTable({
      view,
      layer: featureLayer,
      container: tableRef.current,
      editingEnabled: true,
    });

    return () =&amp;gt; {
      featureTable.destroy();
      view.destroy();
    };
  }, []);

  return (
    &amp;lt;div className="App"&amp;gt;
      &amp;lt;div id="viewDiv" ref={viewRef}&amp;gt;&amp;lt;/div&amp;gt;
      &amp;lt;div id="tableDiv" ref={tableRef}&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}

export default App;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2022 08:22:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/error-destroying-featuretable-instance-during/m-p/1195783#M78060</guid>
      <dc:creator>WongChunKang</dc:creator>
      <dc:date>2022-07-26T08:22:09Z</dc:date>
    </item>
  </channel>
</rss>

