diff options
author | Bob Zeleznik <zzzman@gmail.com> | 2020-07-21 23:57:55 -0400 |
---|---|---|
committer | Bob Zeleznik <zzzman@gmail.com> | 2020-07-21 23:57:55 -0400 |
commit | 9d530f8fc7ca9621274a38260faebe797f66dd60 (patch) | |
tree | f81d0b7d7c648bb89cf827b51f741bf0c5aded46 /src | |
parent | 475cb70c7366a85f1fa3d201daba3822abdad3e6 (diff) |
fixed problem where adding to a collection would cause a remote synchronized collection to erase and redraw since all of its list items got replaced. the fix was to update the 'cache' field of ProxyFields when they are deserialized to use an existing cached value if available.
Diffstat (limited to 'src')
-rw-r--r-- | src/fields/Proxy.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/fields/Proxy.ts b/src/fields/Proxy.ts index 555faaad0..62734d3d2 100644 --- a/src/fields/Proxy.ts +++ b/src/fields/Proxy.ts @@ -9,7 +9,12 @@ import { Id, Copy, ToScriptString, ToString } from "./FieldSymbols"; import { scriptingGlobal } from "../client/util/Scripting"; import { Plugins } from "./util"; -@Deserializable("proxy") +function deserializeProxy(field: any) { + if (!field.cache) { + field.cache = DocServer.GetCachedRefField(field.fieldId) as any; + } +} +@Deserializable("proxy", deserializeProxy) export class ProxyField<T extends RefField> extends ObjectField { constructor(); constructor(value: T); @@ -17,6 +22,7 @@ export class ProxyField<T extends RefField> extends ObjectField { constructor(value?: T | string) { super(); if (typeof value === "string") { + this.cache = DocServer.GetCachedRefField(value) as any; this.fieldId = value; } else if (value) { this.cache = value; |