-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Labels
Description
Note: we can't actually start on this yet because Framework still needs to figure out what the semantics should be for it!
The simplest idea, “match the built-in constructors exactly” can have some weird effects:
let original = { foo: true };
let viaObject = new Object(original);
let viaTrackedObject = new TrackedObject(original);
original.foo = false;
console.log(viaObject.foo); // `false`
console.log(viaTrackedObject); // ???
viaTrackedObject.foo = true;
console.log(original.foo); // ???
console.log(viaObject.foo); // ???- We cannot actually intercept the set on
original.foo, at least with the existingProxy-based implementation, so if we return the (proxied) original we end up with cases where the object is sometimes mutated in a non-tracked fashion and sometimes mutated in a tracked fashion - If we directly walk and install setters for all (own?) properties instead, that probably works but needs to be very carefully documented and very carefully implemented
Additionally, we cannot ever make new TrackedObject() return the desired type from a TypeScript point-of-view.
Related: #73.
Reactions are currently unavailable