Came to say this!
All feelings are valid. Validate, validate, validate. Get on their level and verbalise what it seems like might be going on. 'You seem upset because you couldn't have another ice cream, is that right?' In the moment isn't the time to try and correct behaviour, right after the meltdown is. In the moment is time for support and love and showing them that regardless of how big their emotions are you can handle it, you're not fazed and you love them unconditionally.
After, talk about what happened and what might be a better response next time/what wasn't acceptable behaviour.
Remember as crappy as it is for you to have a toddler rolling around on the floor sobbing it's just as hard, if not moreso, for them. The biggest part of parenting is learning to regulate your own emotions and not let every tantrum lead to anger on the parents' side and inflamed emotions on the toddler's side and so forth.
Don't dismiss them. If something is upsetting to them then it matters, and it might be a huge deal to them. As an adult you might not think green cup versus blue cup is a big deal but they don't have the experience and skills that you have. It IS a big deal for them. Never put them down, dismiss them, humiliate them or tell them they're being ridiculous.
Toddlers especially (but all kids) Are doing the best they can with the tools they possess. You can defuse so many situations by just showing them you're on their side and making the effort to understand what they're going through.