Remove shape/change shape layout via Javascript

I’ve got a weird question. I’m trying to delete /change layout of a specific shape, made by the Drawingtools plugin, once I press a self-made button, however I simply cannot find any documentation about it.

So in this example, if I press the blue button, circled in red, I want my code to either delete, or change the layout of the shape. Is there any way this can be achieved?

This plugin doesn’t support editing created features.
As a workaround you can do something like:

map.getSource('draw-plugin').setData({ // new features without the one to be deleted});

So i’ve tried this one, yet i keep on getting the same error.

message:
“Input data is not a valid GeoJSON object.”

this is the way I tried to implement it:

    map.getSource('draw-plugin').setData({data: feat.filter(x => x.id !== shape.id)})

to get this somewhat easier to understand: the array feat is the array in which I keep all the features

And even weirder, I’m currently experiencing another error.

Error {status: 404, url: ‘http://localhost:3000/[{“id”:81846156,"typ…3061],[-7.133667283650965,55.50921188241065]]]}}]’, name: ‘e’, message: ‘Not Found’}

Am I missing out on some info? Dont know if it will impact me again, but i’m using ReactJS

actually the workaround is also not perfect…

I ended up with:

var features = [];
var removelast = () => {
  features.pop();
  map.getSource('draw-plugin').setData({"type": "FeatureCollection",
  "features": features});
}
ttDrawingTools.on('tomtom.drawingtools.created', (event) => {
  features.push(event.data)
  console.log(event);
})

but it redraws all features when I try to draw something after removing…
so we don’t have a solution

Does this also mean there won’t be a solution coming to this “problem”, or are the TomTom developers currenty working on one or anything else?