Failure?

Margaryta Chepiga
Open Source Adventure
4 min readApr 23, 2018
Me finding solutions to the issue ☝️ From Giphy

Have you ever had a situation when you finally fixed a bug after putting an enormous amount of time & effort? Rhetorical question, isn’t it? I am more than sure that the answer is yes. Do you remember how you felt? Do you remember that exact moment when you realized that you found the solution and it works?

When I found the solution to this bug ( blog post about the issue is here ), I felt ( and reacted ) approximately like this:

From Giphy

But…

In almost every story, there is a but. I found a solution. I checked it. I double check it. And then I checked it again. I couldn’t believe that I did it. I send a pull request, added screen captures and then I got the best feeling ever. The feeling which is the reason for me waking up every morning and the reason for me to not to sleep at night. I felt accomplished. I felt like I did something today. I felt complete. With that, I finally went to sleep.

It was a terrible night. I was sleeping and not sleeping at the same time. All night long, in my dream, my solution was not working. For various reasons. All night I had a feeling that I did something wrong, a mistake. That in reality my solution is either wrong or I just mistyped something and solution is not even a solution. Then I thought that I haven’t fixed it at all, and it was only a dream. So I would wake up in the morning and the solution would not be there as well as the PR.

I woke up before my alarm ring. Went straight to my laptop. I had to know that it is there. I had to know that I fixed it. It was. I felt relieved. But not for long. At the back of my head, I had this annoying feeling that

  • It is not a perfect solution
  • It is wrong, you just don’t know about it yet
  • There must be an edge case that I haven’t covered yet

The weird thing is that my feeling was right. In a couple of days my PR was reviewed and not only my solution was not the best, as it turned out later it was causing a bug.

From Giphy

So the original code was:

My first fix was the following:

Where I basically checked if the url is a new page url, if not then we won’t reset the state.

Even though it looked like it worked ( as in icon was not disappearing anymore ), it didn’t.

According to the various console.log’s the

getBaseUrl === getTargetAboutUrl('about:newtab')

would always return true.

After a couple of hours of debugging & a couple of “try and fail” I found out that if I put the result of the statement in the variable and use a variable instead, the result won’t be always true. Fix number two:

Which means that it works as expected. However, this solution was causing problems too.

I was devastated. I’ve spent so much time and effort. Thought that I found the solution. Twice. But still, it wasn’t it. Give up? Move on to another issue and just forget about it? I couldn’t. After weeks of debugging, understanding the code, involving other people, I just couldn’t drop it. There are certain situations and issues when it is a smart decision to move on. This one felt like it wasn’t. It was certainly hard to keep going. Hard to not give up. But can I grow and learn without overcoming the obstacles? Should I just take the easy way and do things that are familiar and easy for me? What will that decision give me? How would I benefit from it in the future? Apparently, I am just not that type of person who gives up and looking for an easy way. I knew that before, otherwise I wouldn’t be where I am right now, but not always I thought that this is a good thing.

I kept looking for a proper solution and I think I found it.

Originally in windowStore.js we had the same code but without the extra, if statement that you can see above. So basically, I checked if app download action was performed and if not then we want to reset the state. Result? It worked.

Me. From Giphy

Looks extremely easy. Works perfectly. Was it though?

To be honest, I am still not 100% sure that this solution is the best solution. My PR was not re-reviewed yet. Therefore, to sleep better at night I checked all cases that I could found and made sure everything works as expected.

Be Brave. Don’t give up. You are not a failure.

--

--

Margaryta Chepiga
Open Source Adventure

Software Developer, known as overexcited girl who is passionate about technology