The Joy Of Consistent Commits

I used to just commit whenever I was done working. If I worked an hour, or if I worked three hours, I would just commit at the end of that time period. This is problematic because you can’t always account for all of the changes you’ve made during a certain time period.

Recently, I’ve adopted a habit of commiting every single time I implement something from my Trello board. Now I don’t do this for extremely simple fixes but pretty much everything else requires a commit.

A few days ago, I had an incident that really confirmed why I do this. I worked all day on various elements of my new app, Root Basis. (It’s a time tracking app that I’d eventually like to extend to tracking everything.) The next day, or maybe on the way home, I noticed this issue with adding tasks to a time period. On desktop, there was no problem, but on mobile, the task menu wasn’t coming up at all.

I immediately thought it might be an issue with AJAX because I’ve had issues with that before. I ruled that out pretty quickly. Then just to see if it was some kind of responsive design issue, I tried it out in Chrome’s mobile view on my desktop. It worked perfectly.

So I knew now that the issue was specifically with my iPhone. Then when I went between the dev enviroment and production environment, the issue disappeared so I knew it was because of something I changed that day. Unfortunately, I did a lot of work that day and I had no idea where the issue could have come from and I really didn’t want to have to look through each commit to figure out where I went wrong.

Then I had this idea, why not just revert each commit until I found out which commit caused the error. I found it pretty quickly after that.

Normally, an error like this would be unremarkable, but this particular error is very odd to me. That day I had added new code that would reset all the other task menus:

$(“.listOfNewTasks”).html(“”);

So all the task menus would be reset and a new task menu would be generated:

$(“#listOfNewTasks” + timePeriodID).html(getData);

This created a flickering effect that I found jarring so I changed the reset code to:

$(“.listOfNewTasks:not(#listOfNewTasks” + timePeriodID + “)”).html(“”);

Apparently, this works fine on Desktops but is broken on iPhones. Maybe I messed up on the formatting? I plan to research this later and find out.

Leave a Reply

Your email address will not be published. Required fields are marked *