Feature layer overriding supplied object ids

496
1
02-05-2021 08:05 AM
mute55
by
New Contributor

 

Hi all,

 

I'm using version 4.18 of the js api in a react-redux application, where client-side domain objects are updated in real-time, these objects are represented on a MapView via a FeatureLayer.

 

Add/Update/Delete operations are performed via the applyEdits() method on the feature layer, however I have a problem with the feature layer changing the ids of objects after adding them to the feature layer (objectIdField is set to "id", field type of "id" is also set to oid)

 

An example, the feature layer contains features with id's 1, 2, & 3.

I add feature with id 5 via applyEdits() - The returned objectId in addFeatureResults will be 4.
I then add a feature with id 4 via applyEdits() - The returned objectId in addFeatureResults will be 5.
I then add a feature with id 123456 via applyEdits() - The returned objectId in addFeatureResults will be 6.

 

Here lies the issue - The domain objects within the redux state become unsynchronised with the feature layer as the feature layer seems to want sequential objectIds and will assign ids to the features upon them being added. The ids of these features then cannot be used to refer to the objects within the redux state.

 

Is there a way to disable the sequential nature of objectIds? I can always remove "id" as the objectIdField, and retrieve id from the feature manually, but I would rather solve this strange issue if possible.

0 Kudos
1 Reply
UndralBatsukh
Esri Regular Contributor

Hi there, 

Unfortunately, it cannot be done. We have an enhancement request to change this behavior so that the assigned objectIds are kept between edits. I will be sure to update you once we install this change. 

 

-Undral

0 Kudos