Select to view content in your preferred language

FeatureLayer.applyEdits() Stops Working After ~3 Calls

115
4
Jump to solution
yesterday
skuehlshelby
New Contributor

Hello,

I was wondering if anyone could point me in the right direction, as I am stumped. I am using the Javascript 4.30 API in a Vue project with Typescript. I am making a feature layer from client-side graphics. I am using the ClassBreaksRenderer. My map component gets an array of features to be rendered via the component props. When the array changes, I update the feature layer like so:

 

         stationLayer.applyEdits({
                deleteFeatures: oldData.map(makeStationGraphic),
                addFeatures: data.map(makeStationGraphic)
            }).then(console.log, console.log)
         .catch(console.log);

 

 This works fine for the first few times, but after about the 3rd call to applyEdits(), the edits don't show on the map. There is no error message. The EditResult object contains the values I expect. The RefreshEvent object passed on the 'edits' event also looks correct.

My current solution is to delete and re-create the layer after every 3rd edit, but this is obviously silly.

Does anyone have any idea what might be happening here?

0 Kudos
1 Solution

Accepted Solutions
skuehlshelby
New Contributor

Looks like that was my mistake. I shouldn't be managing my own ObjectIDs, they get created automatically.

View solution in original post

0 Kudos
4 Replies
UndralBatsukh
Esri Regular Contributor

Is it possible for you to create a simple codepen app showing the issue here? Thanks

0 Kudos
UndralBatsukh
Esri Regular Contributor

Here is a codepen that adds/deletes features from client-side FeatureLayer - https://codepen.io/U_B_U/pen/PorRwbM

0 Kudos
skuehlshelby
New Contributor

Could it be a problem with the ObjectIDs? I'm currently assigning the object ids manually. It doesn't look like the CodePen is doing that...

0 Kudos
skuehlshelby
New Contributor

Looks like that was my mistake. I shouldn't be managing my own ObjectIDs, they get created automatically.

0 Kudos