Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Why is stuff "obliterated"?
In the video Kenneth says he knows some stuff will be completely obliterated below and then he modifies the save(). I don't understand what and why it will be obliterated. Can someone explain that bit?
Chris FreemanTreehouse Moderator 67,995 Points
save is sending cookie information back to the browser. The issue is what happens if the cookie being held by the browser already has some data in the json object stored in that cookie? If the response ignores this pre-existing cookie data, it will get overwritten ("obliterated") by the new cookie in the response.
Kenneth's solution is to extract the existing cookie info from the request, update only the parts that have changed via the form, then send the updated cookie info back in the response.
This is a Read-Modify-Write flow that is typically used when updating partial information.
I wish all of that would be in the Video, so far this is the most unclear tutorial on TreeHouse what I have seen. I am like reading topics here on the forum to understand what is going on in Videos.