aboutsummaryrefslogtreecommitdiff
path: root/src/new_fields/Doc.ts
diff options
context:
space:
mode:
authorTyler Schicke <tyler_schicke@brown.edu>2019-07-25 12:29:26 -0400
committerTyler Schicke <tyler_schicke@brown.edu>2019-07-25 12:29:26 -0400
commit7a236b1dbd609827828010f52df8eed6e54b6cd5 (patch)
treec028f73c11b29da51d6611927c963d04b1e3fe02 /src/new_fields/Doc.ts
parentd344bb81c43820d606655a4f78dbaedc66ab3638 (diff)
Hopefully fixed release server jittering
Diffstat (limited to 'src/new_fields/Doc.ts')
-rw-r--r--src/new_fields/Doc.ts9
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;
}
}
}