jer0dh (1) [Avatar] Offline
#1
Hi!

Like the book so far and looking forward to more. Wanted to mention this:

The graphic and text indicate that one clones the object stored in the ReactiveVar variable into editObject. This implies one can change editObject without affecting reactiveHouseObject. I found this confusing because I didn't see any process that was cloning this object. Cloning indicates your are copying the object and creating a new object reference. Instead, using the console, I determined it is passing the object by reference so any changes made to the editObject is changing the reactiveHouseObject at the same time. The Meteor "magic" behind the scenes doesn't notice the reactiveHouseObject being changed until the reactiveHouseObject.set(editObject) is called.

At console:
j = reactiveHouseObject.get();
k = reactiveHouseObject.get();

j == k

true

Message was edited by:
jer0dh
stephan.hochhaus (92) [Avatar] Offline
#2
Re: Listing 5-2 and cloning the ReactiveVar
Glad you like the book smilie
The intent is to actually have two independent instances - editObject and reactiveHouseObject. Changing editObject should not affect reactiveHouseObject unless you explicitly store it back into the reactive var.

I will revisit the chapter and make things clearer in one of the next updates.
Thanks for bringing this up!!