I am friends with most of my ex's.
I've had them over for dinner and/or drinks, I've also gone out on the town with then, there has never been a problem. because my SO can plainly see that they're just friends like the rest.
That said I have had an SO who was still "close" to his ex. She lives in a different country. She also worked in his company in her country.
I was cool and, of course, wanted to meet her.
She did NOT want to meet me.
She wasn't "ready".
Yet she texted him constantly, would call crying about her problems (she had a ton of them), asked him to send beauty products not available in her country, etc.
I was not cool with it for long.
So he had to choose. This was pretty early on in our relationship but he chose wisely. Which let lead to her texting me about suicide and.. oh, the poop hit the fan and when on a bit. yeah, she was/os crazy but as far as I know she's alive and poisoning somebody elses life.