From 9d530f8fc7ca9621274a38260faebe797f66dd60 Mon Sep 17 00:00:00 2001 From: Bob Zeleznik Date: Tue, 21 Jul 2020 23:57:55 -0400 Subject: 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. --- src/fields/Proxy.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') 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 extends ObjectField { constructor(); constructor(value: T); @@ -17,6 +22,7 @@ export class ProxyField 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; -- cgit v1.2.3-70-g09d2