We are using Graphic.clone().
const leftGraphic = originalGraphic.clone();
Since the upgrade to 4.33 the layer attribute of the cloned object is null (not undefined) while the layer is set correctly for the original graphic.
Prior to the update the clone also contained a valid layer.
This leads to problems when doing applyEdits on the clones without layer information.
Since it worked before, I assume this is a bug. Can anyone confirm that or show me further info about that? The 4.33 docs only say that clone is doing a deep copy of the graphic. So no hint the layer may is excluded.
Only the fact that the layer is set to null instead of undefined let me imagine this may be intended for some reason.
My workaround is to set the layer manually:
const leftGraphic = originalGraphic.clone();
leftGraphic.layer = originalGraphic.layer;
Solved! Go to Solution.
Hi there,
This was a breaking change introduced in version 4.33, as noted in the release notes here:
https://developers.arcgis.com/javascript/latest/release-notes/#core-api-breaking-changes
To summarize:
To help address this, we’re introducing a new origin property on Graphic which will be cloned automatically. This can be used to indicate where the graphic originally came from, offering a more appropriate way to track its source. I will update you once this property is
Let me know if you have any questions or need further clarification.
Hi there,
This was a breaking change introduced in version 4.33, as noted in the release notes here:
https://developers.arcgis.com/javascript/latest/release-notes/#core-api-breaking-changes
To summarize:
To help address this, we’re introducing a new origin property on Graphic which will be cloned automatically. This can be used to indicate where the graphic originally came from, offering a more appropriate way to track its source. I will update you once this property is
Let me know if you have any questions or need further clarification.
Hey
Thanks for the info.
Though I dont get the reason:
"This is because the cloned graphic is not associated with any layer."
For me that sound like:
"The layer is not included because the layer is not included".