diff options
author | ab <abdullah_ahmed@brown.edu> | 2019-07-14 23:39:56 -0400 |
---|---|---|
committer | ab <abdullah_ahmed@brown.edu> | 2019-07-14 23:39:56 -0400 |
commit | b7dd805549c5cdb6b583312e5e9637f9f3e0ee93 (patch) | |
tree | 24217f91f213e57c503d226bae1475acb84c6a1d /src/new_fields/util.ts | |
parent | baf446a5d65f8e0203eb3c7fb2f43d62a6997daa (diff) | |
parent | d7c6f0da00d4ed56d28f679d6f7de1002684864a (diff) |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web
Diffstat (limited to 'src/new_fields/util.ts')
-rw-r--r-- | src/new_fields/util.ts | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/new_fields/util.ts b/src/new_fields/util.ts index abb777adf..47e467041 100644 --- a/src/new_fields/util.ts +++ b/src/new_fields/util.ts @@ -2,7 +2,6 @@ import { UndoManager } from "../client/util/UndoManager"; import { Doc, Field } from "./Doc"; import { SerializationHelper } from "../client/util/SerializationHelper"; import { ProxyField } from "./Proxy"; -import { FieldValue } from "./Types"; import { RefField } from "./RefField"; import { ObjectField } from "./ObjectField"; import { action } from "mobx"; @@ -13,6 +12,7 @@ function _readOnlySetter(): never { throw new Error("Documents can't be modified in read-only mode"); } const _setterImpl = action(function (target: any, prop: string | symbol | number, value: any, receiver: any): boolean { + //console.log("-set " + target[SelfProxy].title + "(" + target[SelfProxy][prop] + ")." + prop.toString() + " = " + value); if (SerializationHelper.IsSerializing()) { target[prop] = value; return true; @@ -50,6 +50,7 @@ const _setterImpl = action(function (target: any, prop: string | symbol | number target.__fields[prop] = value; } if (value === undefined) target[Update]({ '$unset': { ["fields." + prop]: "" } }); + if (typeof value === "object" && !(value instanceof ObjectField)) debugger; else target[Update]({ '$set': { ["fields." + prop]: value instanceof ObjectField ? SerializationHelper.Serialize(value) : (value === undefined ? null : value) } }); UndoManager.AddEvent({ redo: () => receiver[prop] = value, |