This is a comment baldPrussian gave to this answer. I agree with it and it gives some nice meta info about how to read our two answers together, to preserve his comment I edited into my answer:
Thanks for the compliment! If I may add: I'd suggest reading our two answers in tandem. Mine is more of an immediate solution which relies on the individual realizing the unproductive nature of their behavior; this relies on the person on the receiving end of the bad behavior taking more assertive long-term action. Have an upvote for that reason! – baldPrussian 23 hours ago
While baldPrussian's answer is a valid solution, I personally don't like the confrontation it creates. While I can see why this might be a better solution for most than mine would be, I still want to present an alternative by explaining my personal approach to avoid such situations.
My observation with friends having this behavior, was that it is usually specific topics making a specific person that emotional. When I figured, what exactly it is and after trying to find a way to avoid such a heated situation with a friend by figuring why they overreact, it was already often times possible for me to avoid a trigger for this, if they were able to explain what it is for them.
If it didn't help or they were not able to reflect, what triggers their behavior, I let them know that I won't talk about this specific topic with them anymore. Saying things like:
Hey John, we had this situation now already a few times, and I already told you how uncomfortable I am feeling if you are like this. I just want to let you know that I won't join you in any topics regarding [politics] anymore, as I don't see how to avoid this otherwise.
It is important that you wait till the situation cooled down again for any of my advice here. If you come up with it immediately, I noticed that the other person doesn't take you serious and thinks this is just your response in anger.
Often times people didn't respect this, but that was for me on the long run a reason to not pursue any further contact with them. As I really can't mentally bear people throwing tantrums, even less if they do in the public. And hence someone not cooperating with me here, is someone I don't want to have around me. I would say I got a closer contact to like 5 or 6 people having such attitude, 4 of them I cut loose at one point. But one of the other 2 is actually one of my best friends, and despite we are having such incompatible temperaments, we have found workarounds for almost all our sources of conflict.
So i.E. if they send me an article about some political party and what it intends to do (it be said, our political views are as opposite as they could be without it going in the realm of extremism) I inform them:
I am only reading that article, if you want to hear my opinion about it. And as you know, I am most likely disagreeing with whats written in that article. So if you are in the mood for a calm discussion, lets go for it. But otherwise I will just not pay any attention onto that article.
The keypoint here for example is, I make them aware of the tendency of the polarizing topic, while letting them know it before I know even what that article is about.
(When I don't point out I haven't read it yet, they might take this already as disagreement and get defensive).
And if I have their word for a calm discussion, they pay way more attention on keeping them self calm and this works great for me.
But on the bottom line being said: This approach requires the other person to have at least some amount of social skills. If this is not the case, it might be best to go with baldPrussian's solution, as my reaction for someone not willing(/being able) to cooperate would be simply cutting that person loose, no matter if it is a close friend, SO or just a loose contact.