Deleting a group doesn't delete group contents

  1. Create a group using
const group = await doc.createLayerGroup({
        name: "Group Name",
      })
  1. Create some custom layer using batchPlay, layer will be automatically placed into group
  2. Call await group.delete()

Observe that group is deleted, but the layer that was in the group is now outside any group and is still present.

Try deleting the Group layer instead of the Group itself.

Select only the group layer you want to delete (not all the layers inside) and call the following function. You may need to replace the layerID.

const delLayer = () => {
delLayer batchPlay(
[{"_obj": “delete”,
“_target”: [{"_ref": “layer”,"_enum": “ordinal”,"_value": “targetEnum”}],
“layerID”: [38],
“_isCommand”: true,"_options": {“dialogOptions”: “dontDisplay”}}],
{“synchronousExecution”: false,});
}

Thanks. This is more of a bug report for UXP. I have already workedaround with batch play