I feel you. This happens a lot to me too. My number one tip? Take a break. No seriously. The difference is unreal. If I continue on doing anything while I'm actively angry and annoyed, I always end up doing even worse, which makes me even more angry. Take a step back and try doing something else for a couple of days, when you come back I can guarantee you'll recover at least part of that gap. But continuing while upset is just a terrible idea from personal experience.