Week 9 Day 1 – Almost done!
Yesterday was incredibly productive. I finished majority of my project except for a couple bugs, so the day was mostly spent on hashing out and cleaning up those bugs. I managed to fix, with some help, the followers count bug by making a couple important tweaks to the User reducer. It turns out that I was returning a merged version of my user in state with my currentUser in state whenever I navigated to my own profile. So instead of returning a merged version, I just returned the new action’s user.
Another bug that I ended up solving by referencing some old projects was updating the count real time. I couldn’t figure out how to unmount and remount the component so that the props and state would be updated correctly (I did try componentWillReceiveProps and componentWillUpdate), so instead, within the jbuilder view, I returned an attribute of the photo that represents the number of likes that the photo has by calling length on the respective array. Within the photo reducer, I would increment or decrement this number directly, while also updating the state with the action. This worked flawlessly.
Today however, while working on a couple changes, I’ve introduced a couple new bugs so I’m working on figure those out. I gotta get back to it, so I’ll elaborate on that tomorrow! Talk to you guys then!