From d756ffd3daa24270361648454062e98f190ae964 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Fri, 6 Aug 2021 10:34:57 -0400
Subject: fixed webboxes so that you can link to an annotation and it will
 restore the url as well.   a bunch of warnings cleanup.

---
 src/client/views/collections/CollectionSubView.tsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/client/views/collections/CollectionSubView.tsx')

diff --git a/src/client/views/collections/CollectionSubView.tsx b/src/client/views/collections/CollectionSubView.tsx
index a9b5ce465..227635c9b 100644
--- a/src/client/views/collections/CollectionSubView.tsx
+++ b/src/client/views/collections/CollectionSubView.tsx
@@ -93,7 +93,7 @@ export function CollectionSubView<T, X>(schemaCtor: (doc: Doc) => T, moreProps?:
         childDocFilters = () => [...this.props.docFilters(), ...this.collectionFilters()];
         childDocRangeFilters = () => [...(this.props.docRangeFilters?.() || []), ...this.collectionRangeDocFilters()];
         IsFiltered = () => this.collectionFilters().length || this.collectionRangeDocFilters().length ? "hasFilter" :
-            this.props.docFilters().length || this.props.docRangeFilters().length ? "inheritsFilter" : undefined;
+            this.props.docFilters().length || this.props.docRangeFilters().length ? "inheritsFilter" : undefined
         searchFilterDocs = () => this.props.searchFilterDocs?.() ?? DocListCast(this.props.Document._searchFilterDocs);
         @computed.struct get childDocs() {
             TraceMobx();
-- 
cgit v1.2.3-70-g09d2


From dbdcff75d76fb54a0e085cc0958a07ded32d0b45 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Mon, 9 Aug 2021 18:14:00 -0400
Subject: fixed bug where shared list field items weren't being received as
 Documents so they didn't update -- eg add a private item to a list, then try
 to make it public

---
 src/client/DocServer.ts                            |  2 +-
 src/client/views/collections/CollectionSubView.tsx |  4 ++--
 src/fields/List.ts                                 | 19 +++++++------------
 3 files changed, 10 insertions(+), 15 deletions(-)

(limited to 'src/client/views/collections/CollectionSubView.tsx')

diff --git a/src/client/DocServer.ts b/src/client/DocServer.ts
index f4e3a22cf..e498a7cca 100644
--- a/src/client/DocServer.ts
+++ b/src/client/DocServer.ts
@@ -398,7 +398,7 @@ export namespace DocServer {
                             (_cache[field.id] as any).then((f: any) => fieldMap[field.id] = f);
                         } else if (field) {
                             proms.push(_cache[field.id] as any);
-                            fieldMap[field.id] = field;
+                            fieldMap[field.id] = DocServer.GetCachedRefField(field.id) || field;
                         }
                     }
                 });
diff --git a/src/client/views/collections/CollectionSubView.tsx b/src/client/views/collections/CollectionSubView.tsx
index 227635c9b..2f07c0241 100644
--- a/src/client/views/collections/CollectionSubView.tsx
+++ b/src/client/views/collections/CollectionSubView.tsx
@@ -80,8 +80,8 @@ export function CollectionSubView<T, X>(schemaCtor: (doc: Doc) => T, moreProps?:
         get childLayoutPairs(): { layout: Doc; data: Doc; }[] {
             const { Document, DataDoc } = this.props;
             const validPairs = this.childDocs.map(doc => Doc.GetLayoutDataDocPair(Document, !this.props.isAnnotationOverlay ? DataDoc : undefined, doc)).
-                filter(pair => {  // filter out any documents that have a proto that we don't have permissions to (which we determine by not having any keys
-                    return pair.layout && /*!pair.layout.hidden &&*/ (!pair.layout.proto || (pair.layout.proto instanceof Doc && GetEffectiveAcl(pair.layout.proto) !== AclPrivate));// Object.keys(pair.layout.proto).length));
+                filter(pair => {  // filter out any documents that have a proto that we don't have permissions to
+                    return pair.layout && (!pair.layout.proto || (pair.layout.proto instanceof Doc && GetEffectiveAcl(pair.layout.proto) !== AclPrivate));
                 });
             return validPairs.map(({ data, layout }) => ({ data: data as Doc, layout: layout! })); // this mapping is a bit of a hack to coerce types
         }
diff --git a/src/fields/List.ts b/src/fields/List.ts
index 215dff34b..93a8d1d60 100644
--- a/src/fields/List.ts
+++ b/src/fields/List.ts
@@ -1,4 +1,4 @@
-import { action, observable, runInAction } from "mobx";
+import { action, observable } from "mobx";
 import { alias, list, serializable } from "serializr";
 import { DocServer } from "../client/DocServer";
 import { Scripting } from "../client/util/Scripting";
@@ -264,24 +264,19 @@ class ListImpl<T extends Field> extends ObjectField {
     // this requests all ProxyFields at the same time to avoid the overhead
     // of separate network requests and separate updates to the React dom.
     private __realFields() {
-        const waiting = this.__fields.filter(f => f instanceof ProxyField && f.promisedValue());
-        const promised = waiting.map(f => f instanceof ProxyField ? f.promisedValue() : "");
+        const promised = this.__fields.filter(f => f instanceof ProxyField && f.promisedValue()).map(f => ({ field: f as any, promisedFieldId: (f instanceof ProxyField) ? f.promisedValue() : "" }));
         // if we find any ProxyFields that don't have a current value, then
         // start the server request for all of them
         if (promised.length) {
-            const promise = DocServer.GetRefFields(promised);
+            const batchPromise = DocServer.GetRefFields(promised.map(p => p.promisedFieldId));
             // as soon as we get the fields from the server, set all the list values in one
             // action to generate one React dom update.
-            promise.then(fields => runInAction(() => {
-                waiting.map((w, i) => w instanceof ProxyField && w.setValue(fields[promised[i]]));
-            }));
+            batchPromise.then(pfields => promised.forEach(p => p.field.setValue(pfields[p.promisedFieldId])));
             // we also have to mark all lists items with this promise so that any calls to them
-            // will await the batch request.
-            // This counts on the handler for 'promise' in the call above being invoked before the
+            // will await the batch request and return the requested field value.
+            // This assumes the handler for 'promise' in the call above being invoked before the
             // handler for 'promise' in the lines below.
-            waiting.map((w, i) => {
-                w instanceof ProxyField && w.setPromise(promise.then(fields => fields[promised[i]]));
-            });
+            promised.forEach(p => p.field.setPromise(batchPromise.then(pfields => pfields[p.promisedFieldId])));
         }
         return this.__fields.map(toRealField);
     }
-- 
cgit v1.2.3-70-g09d2

