aboutsummaryrefslogtreecommitdiff
path: root/src/client/DocServer.ts
diff options
context:
space:
mode:
authorab <abdullah_ahmed@brown.edu>2019-07-29 15:44:37 -0400
committerab <abdullah_ahmed@brown.edu>2019-07-29 15:44:37 -0400
commit38b5d646e62535504eb8667b840bf36cd7f2f6d8 (patch)
tree1481b6cdfb9a0853e8405a7dfb96a8fbd9066a9f /src/client/DocServer.ts
parentc2dead205fe719881ca7e254c1872e03a2da9b3d (diff)
parente7ea2028f54787d6c92fb22b789f17b7268d3793 (diff)
more improvemenets tmrw
Diffstat (limited to 'src/client/DocServer.ts')
-rw-r--r--src/client/DocServer.ts20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/client/DocServer.ts b/src/client/DocServer.ts
index 8c64d2b2f..cb460799f 100644
--- a/src/client/DocServer.ts
+++ b/src/client/DocServer.ts
@@ -5,7 +5,6 @@ import { Utils, emptyFunction } from '../Utils';
import { SerializationHelper } from './util/SerializationHelper';
import { RefField } from '../new_fields/RefField';
import { Id, HandleUpdate } from '../new_fields/FieldSymbols';
-import { CurrentUserUtils } from '../server/authentication/models/current_user_utils';
/**
* This class encapsulates the transfer and cross-client synchronization of
@@ -26,7 +25,6 @@ export namespace DocServer {
// this client's distinct GUID created at initialization
let GUID: string;
// indicates whether or not a document is currently being udpated, and, if so, its id
- let updatingId: string | undefined;
export function init(protocol: string, hostname: string, port: number, identifier: string) {
_cache = {};
@@ -126,12 +124,11 @@ export namespace DocServer {
// future .proto calls on the Doc won't have to go farther than the cache to get their actual value.
const deserializeField = getSerializedField.then(async fieldJson => {
// deserialize
- const field = SerializationHelper.Deserialize(fieldJson);
+ const field = await SerializationHelper.Deserialize(fieldJson);
// either way, overwrite or delete any promises cached at this id (that we inserted as flags
// to indicate that the field was in the process of being fetched). Now everything
// should be an actual value within or entirely absent from the cache.
if (field !== undefined) {
- await field.proto;
_cache[id] = field;
} else {
delete _cache[id];
@@ -202,18 +199,18 @@ export namespace DocServer {
// future .proto calls on the Doc won't have to go farther than the cache to get their actual value.
const deserializeFields = getSerializedFields.then(async fields => {
const fieldMap: { [id: string]: RefField } = {};
- const protosToLoad: any = [];
+ // const protosToLoad: any = [];
for (const field of fields) {
if (field !== undefined) {
// deserialize
- let deserialized: any = SerializationHelper.Deserialize(field);
+ let deserialized = await SerializationHelper.Deserialize(field);
fieldMap[field.id] = deserialized;
// adds to a list of promises that will be awaited asynchronously
- protosToLoad.push(deserialized.proto);
+ // protosToLoad.push(deserialized.proto);
}
}
// this actually handles the loading of prototypes
- await Promise.all(protosToLoad);
+ // await Promise.all(protosToLoad);
return fieldMap;
});
@@ -304,9 +301,6 @@ export namespace DocServer {
}
function _UpdateFieldImpl(id: string, diff: any) {
- if (id === updatingId) {
- return;
- }
Utils.Emit(_socket, MessageStore.UpdateField, { id, diff });
}
@@ -329,11 +323,7 @@ export namespace DocServer {
// extract this Doc's update handler
const handler = f[HandleUpdate];
if (handler) {
- // set the 'I'm currently updating this Doc' flag
- updatingId = id;
handler.call(f, diff.diff);
- // reset to indicate no ongoing updates
- updatingId = undefined;
}
};
// check the cache for the field