In this episode, we're tackling a couple of little problems with our profile photo upload. Have you ever cropped a photo just the way you want it, but then changed your mind and couldn't find a way to remove it? That's what we're fixing!
First, we add a simple "clear" button next to the cropped image so that if you decide you don't want to upload that photo after all, you can just wipe it away—no more having to refresh the whole page! We walk through updating the code to handle not just the visual reset, but also clearing out the actual data, including the image itself and the cropped version.
Then, we catch and fix a sneaky side effect: if you clear the photo, but then submit the form, the old cropped image still ends up getting uploaded. We show you how to make sure a cleared image actually gets cleared from the form's data entirely, dispatching the right values and guarding against accidental uploads.
By the end of this video, we've got a slick profile photo field where you can pick, crop, clear, and save photos—no surprises! 🚀