diff options
author | Geireann Lindfield Roberts <60007097+geireann@users.noreply.github.com> | 2020-11-01 22:58:45 +0800 |
---|---|---|
committer | Geireann Lindfield Roberts <60007097+geireann@users.noreply.github.com> | 2020-11-01 22:58:45 +0800 |
commit | fa65753233e17d90a3306432bba9d212307e5b68 (patch) | |
tree | 005123322c4a65b558e7ece45edcffe20b8dca1d /src/fields/Doc.ts | |
parent | 3def219d20179486fe3427c957f680e5d1d705df (diff) | |
parent | 7b96bc4770bd275db0ddd664bb6e8ff33bbbcb78 (diff) |
Merge branch 'master' into presentation_v1
Diffstat (limited to 'src/fields/Doc.ts')
-rw-r--r-- | src/fields/Doc.ts | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index adda40621..4c3c45d92 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -92,6 +92,7 @@ export const AclAddonly = Symbol("AclAddonly"); export const AclEdit = Symbol("AclEdit"); export const AclAdmin = Symbol("AclAdmin"); export const UpdatingFromServer = Symbol("UpdatingFromServer"); +export const ForceServerWrite = Symbol("ForceServerWrite"); export const CachedUpdates = Symbol("Cached updates"); const AclMap = new Map<string, symbol>([ @@ -185,9 +186,10 @@ export class Doc extends RefField { @observable public [AclSym]: { [key: string]: symbol }; private [UpdatingFromServer]: boolean = false; + private [ForceServerWrite]: boolean = false; private [Update] = (diff: any) => { - !this[UpdatingFromServer] && DocServer.UpdateField(this[Id], diff); + (!this[UpdatingFromServer] || this[ForceServerWrite]) && DocServer.UpdateField(this[Id], diff); } private [Self] = this; @@ -680,7 +682,7 @@ export namespace Doc { templateLayoutDoc.resolvedDataDoc && (templateLayoutDoc = Cast(templateLayoutDoc.proto, Doc, null) || templateLayoutDoc); // if the template has already been applied (ie, a nested template), then use the template's prototype if (!targetDoc[expandedLayoutFieldKey]) { _pendingMap.set(targetDoc[Id] + expandedLayoutFieldKey + args, true); - setTimeout(() => { + setTimeout(action(() => { const newLayoutDoc = Doc.MakeDelegate(templateLayoutDoc, undefined, "[" + templateLayoutDoc.title + "]"); // the template's arguments are stored in params which is derefenced to find // the actual field key where the parameterized template data is stored. @@ -694,7 +696,7 @@ export namespace Doc { targetDoc[expandedLayoutFieldKey] = newLayoutDoc; _pendingMap.delete(targetDoc[Id] + expandedLayoutFieldKey + args); - }); + })); } } } |