const person = Obj.make(Person, { name: 'John', age: 25 });
// Mutate within Obj.update
Obj.update(person, (obj) => {
obj.name = 'Jane';
obj.age = 30;
});
// ONE notification fires here
// Direct mutation throws
person.name = 'Bob'; // Error: Cannot modify outside Obj.update()
Note: Only accepts objects. Use Relation.update for relations.
Perform mutations on an echo object within a controlled context.
All mutations within the callback are batched and trigger a single notification when the callback completes. Direct mutations outside of
Obj.updatewill throw an error for echo objects.This function also works with nested objects within echo objects (e.g., Template structs) that are reactive at runtime.