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?
Solved! Go to Solution.
Looks like that was my mistake. I shouldn't be managing my own ObjectIDs, they get created automatically.
Is it possible for you to create a simple codepen app showing the issue here? Thanks
Here is a codepen that adds/deletes features from client-side FeatureLayer - https://codepen.io/U_B_U/pen/PorRwbM
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...
Looks like that was my mistake. I shouldn't be managing my own ObjectIDs, they get created automatically.