diff options
Diffstat (limited to 'src/fields/util.ts')
-rw-r--r-- | src/fields/util.ts | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/fields/util.ts b/src/fields/util.ts index 62f27c7d2..f365adf4b 100644 --- a/src/fields/util.ts +++ b/src/fields/util.ts @@ -16,7 +16,7 @@ import { PrefetchProxy, ProxyField } from './Proxy'; import { RefField } from './RefField'; import { RichTextField } from './RichTextField'; import { SchemaHeaderField } from './SchemaHeaderField'; -import { ComputedField } from './ScriptField'; +import { ComputedField, ScriptField } from './ScriptField'; import { ScriptCast, StrCast } from './Types'; function _readOnlySetter(): never { @@ -69,10 +69,12 @@ const _setterImpl = action(function (target: any, prop: string | symbol | number if (writeToDoc) { if (value === undefined) { - delete target[FieldKeys][prop]; + target[FieldKeys] && delete target[FieldKeys][prop]; // Lists don't have a FieldKeys field delete target.__fieldTuples[prop]; } else { - target[FieldKeys][prop] = true; + // bcz: uncomment to see if server is being updated + // console.log(prop + ' = ' + value + '(' + curValue + ')'); + target[FieldKeys] && (target[FieldKeys][prop] = true); // Lists don't have a FieldKeys field target.__fieldTuples[prop] = value; } |