This story is a direct precursor to this revelation I had in this story.
It was close to the end of QA cycle, days before pushing to production. Someone untimely found a very strange racing condition bug. It was when a component makes multiple requests calls quickly, the response he got back may be inaccurate (like a search box that makes a new request for every key press). This was a difficult problem to tackle with because it was very hard to recreate. I couldn't no matter how hard I overloaded my computer, but the QA person's could with very casual setting; the difference between laptop hardware was apparently astounding.
Since this came out of blue and difficult to even diagnose the problem, my supervisor came in to voice his opinion on the bug. However, his suggestion was difficult to accept as is, because he has contributed less than 20 lines of code and never bothered to familiarize himself with the code base. So it was a lot of conjectures and inductions from quick glances.
After some discussions with him about how he thought his suggestions would work, I went back to my desk and coded up the closest implementation possible. Since I can't test it myself, I deployed for the QA person to test. The fix failed.
This process would repeat itself throughout the next couple days. I would spend a few hours to code something that should work. QA would fail it. The supervisor asked for update of the situation. Then gave his suggestion. Followed by some questions from me. I would go back and code up something that would fail.
During the last iteration of this stressful cycle. He couldn't take any more question from me anymore. He started accusing me not wanting to help and I just didn't care. I was immediately taken aback, especially since I was the person solo agonizing this one bug for days.
I let him vent for maybe 3 minutes first. Then when he has a moment of pause, I calmly pointed on screen the exact location where I implemented his suggestion. Then told him that I have been listening, and doing what he suggested, it just that those fixes did not work. Immediately his facial expression softened, and he did not speak for a good full minute. He never apologized for his lash out, but I could see his slight regret behind the struggle to keep his head high.
We talked for several more minutes. Mostly just nonsense relating to the bug. I knew that it was his way of getting his emotions over so I played along and conversed intently. I departed after what seemed to be an hour of nonstop talking, and went back to my desk to continue the struggle over this stupid bug.
That sprint ended up not requiring the bug fixed for production. This was something I asked for when the bug was discovered. It was a racing condition problem that could not be recreated on but one laptop that's way past retirement. So holding off months of hard work over this made no sense to me. This was, I guess, my reward for the difficult conversation I had to handle.
As for the bug, I eventually solved it by implementing a cache-like layer for the component. When a request is made, the component gives a cacheKey (or just the "this"). The service layer will make a lot of request, each corresponding to a unique key. Whenever a promise is resolved, the service layer will check if the resolved promise corresponds to the latest cacheKey, if not then nothing happens. If it is the correct promise resolved, the response body will be passed upward to the component.