diff --git a/runtime/pointers.ts b/runtime/pointers.ts index 822b226..6d4cf9a 100644 --- a/runtime/pointers.ts +++ b/runtime/pointers.ts @@ -3887,7 +3887,12 @@ export class Pointer extends Ref { if (is_array && Number(prop)+1==obj.length) Runtime.runtime_actions.trimArray(obj) return true - } + }, + ownKeys: (target) => { + // assume that the whole object should be observed for transform + this.handleBeforeNonReferencableGet(); + return Reflect.ownKeys(target); + }, }); // set right 'this' context for getters / setters diff --git a/types/native_types.ts b/types/native_types.ts index 438898a..dd0dc2d 100644 --- a/types/native_types.ts +++ b/types/native_types.ts @@ -181,7 +181,8 @@ Type.std.Set.setJSInterface({ create_proxy: (value:Set, pointer:Pointer) => { // override methods Object.defineProperty(value, "add", {value: el => { - return pointer.handleAdd(el); + if (value.has(el)) return false; + return pointer.handleAdd(el); // TODO: return the Set }, writable:false, enumerable:false}); Object.defineProperty(value, "clear", {value: () => { @@ -189,7 +190,8 @@ Type.std.Set.setJSInterface({ }, writable:false, enumerable:false}); Object.defineProperty(value, "delete", {value: el => { - return pointer.handleRemove(el); + if (!value.has(el)) return false; + return pointer.handleRemove(el); // TODO: return the Set }, writable:false, enumerable:false}); /**** override getters to trigger handleBeforeValueGet(): ****/