<?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: Editor Widget throwing &amp;quot;Uncaught TypeError: Cannot destructure property 'objectIdField'&amp;quot; in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-throwing-quot-uncaught-typeerror/m-p/1113188#M75148</link>
    <description>&lt;P&gt;Bit of extra troubleshooting, I think its a ViteJS bundling issue. I don't have the knowledge or experience to be authoritative with that statement though!&lt;/P&gt;&lt;P&gt;I've managed to build my application using WebPack instead and it is now seems to be functioning as desired.&lt;/P&gt;&lt;P&gt;Glad I was able to bodge it to the next step!&lt;/P&gt;</description>
    <pubDate>Tue, 02 Nov 2021 14:02:11 GMT</pubDate>
    <dc:creator>LukeCalladine</dc:creator>
    <dc:date>2021-11-02T14:02:11Z</dc:date>
    <item>
      <title>Editor Widget throwing "Uncaught TypeError: Cannot destructure property 'objectIdField'"</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-throwing-quot-uncaught-typeerror/m-p/1110287#M75059</link>
      <description>&lt;P&gt;Hey all,&lt;/P&gt;&lt;P&gt;Another brick wall appears in front of me so soon since my first one!&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've managed to translate all my code into ES6 using ViteJS which solved my module bundler issues that we're causing my last problem.&lt;/P&gt;&lt;P&gt;However I've now run into a issue when using the EditorWidget within my web map application(which worked when using CDN).&lt;/P&gt;&lt;P&gt;I'm loading the Editor Widget with the following simple code:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;let editor = new Editor({
        view: mapview
    })
mapview.ui.add(editor, {
        position: "top-right"
    });&lt;/LI-CODE&gt;&lt;P&gt;The Widget is able to load and provides me with the normal Widget Panel (I've done no changes to the Widget itself, I'm just literally calling the Widget for the single layer from my local Portal).&lt;/P&gt;&lt;P&gt;I'm able to Edit via the Widget and Save/Apply the edits successfully - the issue occurs when I try and Insert a new feature where I get the following error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Uncaught TypeError: Cannot destructure property 'objectIdField' of 't15' as it is null.
at p10._getLabel (@arcgis_core_widgets_Editor.js?v=fd72f127:3971)&lt;/LI-CODE&gt;&lt;P&gt;The insert does commit and is saved to the Portal correctly, but the above error causes the Widget to freeze and nothing else can be done.&lt;/P&gt;&lt;P&gt;I fear this is likely beyond my comprehension as its within the Widget - but I also wonder if its the module bundler doing something? As I mentioned in my last post - I have no real experience with module bundlers. After attempting to naively work out where the error may be coming from - I've had a look in the corresponding file that I think the error is generated from (WorkFlow.js)? But I'm not too sure!&lt;/P&gt;&lt;P&gt;Be disappointing if the app gets to the literal final hurdle and dies!&lt;/P&gt;&lt;P&gt;I'm not really sure what else I can share but here is my package.json file if it helps:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
  "name": "small-map-editor",
  "version": "0.0.0",
  "scripts": {
    "dev": "vite --host",
    "build": "vite build",
    "serve": "vite preview"
  },
  "devDependencies": {
    "vite": "^2.6.4"
  },
  "dependencies": {
    "@arcgis/core": "^4.21.2",
    "jquery": "^3.6.0"
  }
}&lt;/LI-CODE&gt;&lt;P&gt;Any chance someone could put me out of my misery again?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Oct 2021 15:27:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-throwing-quot-uncaught-typeerror/m-p/1110287#M75059</guid>
      <dc:creator>LukeCalladine</dc:creator>
      <dc:date>2021-10-22T15:27:27Z</dc:date>
    </item>
    <item>
      <title>Re: Editor Widget throwing "Uncaught TypeError: Cannot destructure property 'objectIdField'"</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-throwing-quot-uncaught-typeerror/m-p/1110302#M75060</link>
      <description>&lt;P&gt;Small update yet potentially glorious (ended up being shortlived...).&lt;/P&gt;&lt;P&gt;I've just tried building out the application instead of running it via 'npm run dev'.&lt;/P&gt;&lt;P&gt;When serving the built version I no longer experience the error. Not sure why that would be the case.&lt;/P&gt;&lt;P&gt;EDIT : Getting slightly more bizarre. I have two computers. Computer 2 is the host PC.&lt;/P&gt;&lt;P&gt;Computer 1 - dev - Editor Widget errors with the initial error above.&lt;BR /&gt;Computer 1 - build - Editor Widget errors with "Uncaught TypeError: Cannot destructure property 'objectIdField' of 't' as it is null." similar to initial dev error.&lt;/P&gt;&lt;P&gt;Computer 2 (host) - dev - Editor Widget errors with the initial error above.&lt;BR /&gt;Computer 2 (host) - build - Editor Widget works, no issues at all.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Oct 2021 16:51:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-throwing-quot-uncaught-typeerror/m-p/1110302#M75060</guid>
      <dc:creator>LukeCalladine</dc:creator>
      <dc:date>2021-10-22T16:51:10Z</dc:date>
    </item>
    <item>
      <title>Re: Editor Widget throwing "Uncaught TypeError: Cannot destructure property 'objectIdField'"</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-throwing-quot-uncaught-typeerror/m-p/1110336#M75061</link>
      <description>&lt;P&gt;This is where its erroring apparently at the&amp;nbsp;{objectIdField: i} = t line:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;_getLabel(e) {
const t = e.layer
, {objectIdField: i} = t
, {attributes: r} = e
, n = bR(t);
return n &amp;amp;&amp;amp; r[n] &amp;amp;&amp;amp; `${r[n]}` || Kr(this.messages.untitledFeatureTemplate, {
id: r[i]
})
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Oct 2021 16:38:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-throwing-quot-uncaught-typeerror/m-p/1110336#M75061</guid>
      <dc:creator>LukeCalladine</dc:creator>
      <dc:date>2021-10-22T16:38:26Z</dc:date>
    </item>
    <item>
      <title>Re: Editor Widget throwing "Uncaught TypeError: Cannot destructure property 'objectIdField'"</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-throwing-quot-uncaught-typeerror/m-p/1110527#M75064</link>
      <description>&lt;P&gt;Not sure exactly what your app looks like, but I put together a simple app with vite and the Editor.&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/odoe/vite-jsapi-editor" target="_blank"&gt;https://github.com/odoe/vite-jsapi-editor&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Maybe this can help&lt;/P&gt;</description>
      <pubDate>Sat, 23 Oct 2021 21:27:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-throwing-quot-uncaught-typeerror/m-p/1110527#M75064</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2021-10-23T21:27:22Z</dc:date>
    </item>
    <item>
      <title>Re: Editor Widget throwing "Uncaught TypeError: Cannot destructure property 'objectIdField'"</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-throwing-quot-uncaught-typeerror/m-p/1112832#M75134</link>
      <description>&lt;P&gt;Hey Rene,&lt;/P&gt;&lt;P&gt;Thanks for your response and sorry for my late reply, I was on vacation - I've cloned your repository and all works well as I expected it would!&lt;/P&gt;&lt;P&gt;I've done a bit more troubleshooting and I think the issue is potentially a Portal / Layer on Portal issue or the interaction between the API and our Portals?&lt;/P&gt;&lt;P&gt;If I copy the layer that you've used from the CodePen example on the Samples section of the JS API site using the "Create feature layer from URL" in two different internal portals (one is 10.7.1, the other is 10.9) - the copied layer works correctly in every Vite/Node environment (run dev, run serve, http-server) I've tried.&lt;/P&gt;&lt;P&gt;It seems the error occurs on layers which are either, manually created on either Portals or manually uploaded from SHP/GDB to the Portals, or even published to Portal via ArcMap/Pro - if the layer is duplicated FROM AGOL to the Portals it works.&lt;/P&gt;&lt;P&gt;Interestingly, if I duplicate the layers which error from the Portals to AGOL, the layers work correctly also.&lt;/P&gt;&lt;P&gt;Is layer creation that different on AGOL vs Portals 10.7.1 or 10.9?&lt;/P&gt;</description>
      <pubDate>Mon, 01 Nov 2021 13:11:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-throwing-quot-uncaught-typeerror/m-p/1112832#M75134</guid>
      <dc:creator>LukeCalladine</dc:creator>
      <dc:date>2021-11-01T13:11:55Z</dc:date>
    </item>
    <item>
      <title>Re: Editor Widget throwing "Uncaught TypeError: Cannot destructure property 'objectIdField'"</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-throwing-quot-uncaught-typeerror/m-p/1113168#M75147</link>
      <description>&lt;P&gt;Continued troubleshooting, definitely seems an issue between the communication of the Application API and both of our Portals.&lt;/P&gt;&lt;P&gt;As in my other reply - if I load the layer that you use in your Github example (or any layer on AGOL it seems) it works as intended.&lt;/P&gt;&lt;P&gt;If I load a local copy of the layer you use (i.e. save it to either Portal and load from there - I'm able to make edit records correctly, I'm also able to insert records correctly BUT I'm unable to start inserting a record and then back out of the process with it once again giving me the same objectIdField of 't' error.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LukeCalladine_0-1635857751088.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/26600i646798752CEC15B7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LukeCalladine_0-1635857751088.png" alt="LukeCalladine_0-1635857751088.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Any other local layer, on either Portal, is able to be edited - but I'm unable to insert or insert and then back out of the process without the above objectIdField of 't' error occurring.&lt;/P&gt;&lt;P&gt;I've attached my code, but I'm not sure how much help it will be since the error occurs both in your example (using my layers) and also my code (with my layers).&lt;/P&gt;&lt;P&gt;Are the Portals too far in version behind AGOL? I thought 10.9 was the latest portal version? Are the functionalities not compatible? Or is it ViteJS that's packaging incorrectly (can it even do that? Why would it package correctly for AGOL items but not Portal Items?)&lt;/P&gt;</description>
      <pubDate>Tue, 02 Nov 2021 13:09:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-throwing-quot-uncaught-typeerror/m-p/1113168#M75147</guid>
      <dc:creator>LukeCalladine</dc:creator>
      <dc:date>2021-11-02T13:09:12Z</dc:date>
    </item>
    <item>
      <title>Re: Editor Widget throwing "Uncaught TypeError: Cannot destructure property 'objectIdField'"</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-throwing-quot-uncaught-typeerror/m-p/1113188#M75148</link>
      <description>&lt;P&gt;Bit of extra troubleshooting, I think its a ViteJS bundling issue. I don't have the knowledge or experience to be authoritative with that statement though!&lt;/P&gt;&lt;P&gt;I've managed to build my application using WebPack instead and it is now seems to be functioning as desired.&lt;/P&gt;&lt;P&gt;Glad I was able to bodge it to the next step!&lt;/P&gt;</description>
      <pubDate>Tue, 02 Nov 2021 14:02:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-throwing-quot-uncaught-typeerror/m-p/1113188#M75148</guid>
      <dc:creator>LukeCalladine</dc:creator>
      <dc:date>2021-11-02T14:02:11Z</dc:date>
    </item>
    <item>
      <title>Re: Editor Widget throwing "Uncaught TypeError: Cannot destructure property 'objectIdField'"</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-throwing-quot-uncaught-typeerror/m-p/1115442#M75218</link>
      <description>&lt;P&gt;&amp;nbsp;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/283137"&gt;@LukeCalladine&lt;/a&gt;&amp;nbsp;this is a bug that only appears to happen when using ESM. We just recently noticed this in another workflow.&lt;/P&gt;&lt;P&gt;Could you try adding this bit of code into your app to see if you still experience this issue?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// temp workaround
const origGetLabel = Editor.prototype._getLabel;
Editor.prototype._getLabel = function(feature) {
  if (!feature.layer) {
    return null;
  }
  return origGetLabel.call(this, feature);
};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 21:58:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-throwing-quot-uncaught-typeerror/m-p/1115442#M75218</guid>
      <dc:creator>HeatherGonzago</dc:creator>
      <dc:date>2021-11-09T21:58:51Z</dc:date>
    </item>
    <item>
      <title>Re: Editor Widget throwing "Uncaught TypeError: Cannot destructure property 'objectIdField'"</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-throwing-quot-uncaught-typeerror/m-p/1116044#M75256</link>
      <description>&lt;P&gt;Hey Heather,&lt;/P&gt;&lt;P&gt;Thanks for the update, I've actually transitioned my project to Webpack now so can't test the code right now.&lt;/P&gt;&lt;P&gt;I'm creating a new ViteJS app now, so if I run into the same problem I will apply this solution and see if it works,&lt;/P&gt;&lt;P&gt;Luke&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 16:03:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-throwing-quot-uncaught-typeerror/m-p/1116044#M75256</guid>
      <dc:creator>LukeCalladine</dc:creator>
      <dc:date>2021-11-11T16:03:39Z</dc:date>
    </item>
  </channel>
</rss>

