TypeError: Cannot read property 'length' of undefined after applyEdits in custom arcgis js api build

83
2
Jump to solution
10-27-2020 04:56 AM
Highlighted
New Contributor

Hi All, 

We use custom dojo build to build arcgis js api. The configuration build.profile.js file is always the same as one from the official example from github, the only difference is paths. After updating to version 4.17 we started getting errors after applyEdits operations(Updating object in Editor widget). The exception is below, exception throws during query operations after applyEdits and only for feature layers that are loaded as json, e.g. there is no error after editing objects from Feature layer that is loaded as pbf buffer. 

"TypeError: Cannot read property 'length' of undefined
at Function.d.fromOptimizedFeatureSet (http://<>/esri/views/2d/layers/features/Pipeline.js:1153:197)
at Function.d.fromFeatureSet (http://<>/esri/views/2d/layers/features/Pipeline.js:1152:492)
at c.<anonymous> (http://<>/esri/views/2d/layers/features/Pipeline.js:979:91)
at d (http://<>/dojo/dojo-lite.js:47:190)
at Object.next (http://<>/dojo/dojo-lite.js:45:492)
at g (http://<>/dojo/dojo-lite.js:45:275)"

I tried to change url for loading arcgis js from custom to http://js.arcgis.com/4.17cdn  and there were no errors.

After debuging Pipeline.js I found a difference between http://js.arcgis.com/4.17  Pipeline.js and local, JSON parsed FeatureSet after query often has parameter fields = undefined because there is no features found in specific geometry. 

So after Convert function it throws error during for loop because a is undefined. In Pipeline.js from http://js.arcgis.com/4.17  fields are always [] instead of undefined.

I modified wrong line localy

 e.fields = a.fields ? a.fields : [];

and it fixed the error.

 

Anyway I have a question is there a posibility that js version from http://js.arcgis.com/4.17 differs from custom build one or even downloded version from Get the API | ArcGIS API for JavaScript 4.17 ? Is there something wrong by our side? Or there is a bug in version on github? 

Is anyone facing the same issue? 

Tags (3)
Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
Frequent Contributor

I pushed an update to npm, arcgis-js-api@4.17.2

This includes a couple of fixes that were done recently, can you see if that now fixes your editing issue?

View solution in original post

Reply
0 Kudos
2 Replies
Highlighted
Frequent Contributor

I pushed an update to npm, arcgis-js-api@4.17.2

This includes a couple of fixes that were done recently, can you see if that now fixes your editing issue?

View solution in original post

Reply
0 Kudos
Highlighted
New Contributor

It fixes the issue, thank you very much for your answer and update  

Reply
0 Kudos