diff options
author | Tyler Schicke <tyler_schicke@brown.edu> | 2019-07-25 12:29:26 -0400 |
---|---|---|
committer | Tyler Schicke <tyler_schicke@brown.edu> | 2019-07-25 12:29:26 -0400 |
commit | 7a236b1dbd609827828010f52df8eed6e54b6cd5 (patch) | |
tree | c028f73c11b29da51d6611927c963d04b1e3fe02 /src/new_fields/Doc.ts | |
parent | d344bb81c43820d606655a4f78dbaedc66ab3638 (diff) |
Hopefully fixed release server jittering
Diffstat (limited to 'src/new_fields/Doc.ts')
-rw-r--r-- | src/new_fields/Doc.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/new_fields/Doc.ts b/src/new_fields/Doc.ts index 64b4acb7b..5e98ec48c 100644 --- a/src/new_fields/Doc.ts +++ b/src/new_fields/Doc.ts @@ -75,6 +75,8 @@ function fetchProto(doc: Doc) { } } +let updatingFromServer = false; + @scriptingGlobal @Deserializable("doc", fetchProto).withFields(["id"]) export class Doc extends RefField { @@ -129,6 +131,9 @@ export class Doc extends RefField { private ___fields: any = {}; private [Update] = (diff: any) => { + if (updatingFromServer) { + return; + } DocServer.UpdateField(this[Id], diff); } @@ -150,7 +155,9 @@ export class Doc extends RefField { } const value = await SerializationHelper.Deserialize(set[key]); const fKey = key.substring(7); + updatingFromServer = true; this[fKey] = value; + updatingFromServer = false; } } const unset = diff.$unset; @@ -160,7 +167,9 @@ export class Doc extends RefField { continue; } const fKey = key.substring(7); + updatingFromServer = true; delete this[fKey]; + updatingFromServer = false; } } } |