beforeDelete hook

Hi, we need to make some checks before deleting one or more parts, and some of those checks need a response from an API endpoint. I found an older post about this topic but I’m not sure what’s the best workflow in this case.

Can you help, please?

Well, how do you want the workflow to go?

I suspect you want to override the CommandHandler.deleteSelection command to start whatever your asynchronous process is along with a copy of the Diagram.selection. When that process completes successfully, you can reselect all of those Parts by calling Diagram.selectCollection and then call the super method, CommandHandler.deleteSelection. If the process fails because parts are not supposed to be deleted after all, then it’s just a no-op.

Thank you, that should work for me.