Week 9 Day 4 – So many bugs, so little time
DUDE. I’m getting some of the craziest bugs.
There’s two that are major on my list at the moment, and I’m definitely working on figuring them out.
The first is one that I’ve found earlier last night. This particular bug is weird because it results in my comments being displayed from the most recent at the top, to the oldest comment at the bottom. For those of you that have used Instagram before, you know this is definitely not the expected behavior of Instagram. The most recent comments are appended to the bottom of each window display.
I struggled with this bug, and I’m not really satisfied with the solution. It’s really more like putting a bandaid over the it, rather than stitching the wound together. After digging at the bug for awhile, here’s what I found. In the database, the comments are stored in the correct order. It’s when I drew the associations within jBuilder to format my results into JSON that somehow, my array of comments get flipped. The bandaid solution was to throw on a reverse at the end of the association call, but I’m not satisfied with that workaround. I want to know WHY that happens, and it’s frustrating when I don’t.
The second bug, I haven’t found a solution to, so it’s actually missing from my Live version of my app. The strangest thing is that it works on my local machine, but when I push it to Heroku, which is where I’m hosting my app, it breaks. The feature I’m talking about is Infinite Scrolling, or in this case lazy loading. I still haven’t figured out why it isn’t working.
I followed the request and response path of my request for more post to be appended onto the feed, and on my local server, everything works absolutely PERFECTLY, like an absolute dream. But I throw it on Heroku, and instead of returning the array of 10 photo objects I expect, it returns nothing. No error, no undefined, just an empty array. At first, I theorized that it might’ve been due to the way dates and times were passed as queries into Heroku’s database. Date/times are passed in a more complex format that include full date, and time down to milliseconds and timezones. Speaking of which…. that could be another avenue to explore. I had previously made changes to my machine’s default timezones. But I highly doubt that’s the reason, since I tried just searching up the photo id. Which doesn’t really work if I want to write more robust code, but since I wanted to try to get it working for my live site in order to submit, I was hoping it’d work to just query by photo id rather than creation time and date. Nope that didn’t work either. I still got a ways to go to figure out this bug, and I’ll keep you guys updated.
Until tomorrow, take care!