This sounds like drama brewing, unless I misunderstood some detail. If a person is clearly attracted to you, yet decides to date someone else and potentially even continues showing signs of attraction to you while dating someone else or being in a relationship with them, I'd ditch that person and stay away from them. I'd even ditch the entire social circle if I had to. I have done that multiple times now.
Someone who is 'serious' about being interested in you and has their mental state in order, ought to act in a way that aligns with their thoughts and feelings, instead of thinking one thing, feeling something else, saying something else, and also doing something else.
So in practical terms, if for instance they are 'interested' in you, then they should and try and get to know you, or give you a window of opportunity to get to know them through conversation... instead of being evasive, avoidant, dating other people, or just generally not being straightforward with you. That sort of stupid sh*t behaviour will send you on a loop. It is also insensitive on the part of such people to show signals of interest and attraction to draw you in, and then effectively reject you by going off with someone else and never having the courage to even be straightforward about it with you. That's not the kind of person that has a strong character or integrity, and nor is someone who is potentially already in a relationship, but flirting with other people. I don't like it, and I make that pretty clear with my body language/facial expression when such people act this way towards me.
That's my advice from my experience. I avoid people who I see sending mixed signals. In fact I often even avoid such people if I see them sending mixed signals to others, not necessarily just myself. This applies to guy friends too. If he's showing interest in one woman and then fks off to hook up with another... then I'm probably not going to get along with him in most social settings. My beef specifically with these types of women is that they often don't think (or care) that this sort of behaviour upsets many guys as well. It's as if most of these types of women are under the misconception that most men are promiscuous f**kboys (this is called 'projection') and so deserve to be treated the same way those types of men often treat women.