From b05061f6c20c2c953ff43727b8a29d704ec4b392 Mon Sep 17 00:00:00 2001 From: Bob Zeleznik Date: Sat, 28 Mar 2020 10:56:01 -0400 Subject: fixed runtime errors when collection data field has image or non-list value. cleaned up creating buttons. --- src/new_fields/Doc.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/new_fields') diff --git a/src/new_fields/Doc.ts b/src/new_fields/Doc.ts index da723b43b..9d90c569a 100644 --- a/src/new_fields/Doc.ts +++ b/src/new_fields/Doc.ts @@ -352,6 +352,9 @@ export namespace Doc { // return the doc's proto, but rather recursively searches through the proto inheritance chain // and returns the document who's proto is undefined or whose proto is marked as a base prototype ('isPrototype'). export function GetProto(doc: Doc): Doc { + if (doc instanceof Promise) { + console.log("GetProto: error: got Promise insead of Doc") + } const proto = doc && (Doc.GetT(doc, "isPrototype", "boolean", true) ? doc : (doc.proto || doc)); return proto === doc ? proto : Doc.GetProto(proto); } @@ -502,7 +505,7 @@ export namespace Doc { // if the childDoc is a template for a field, then this will return the expanded layout with its data doc. // otherwise, it just returns the childDoc export function GetLayoutDataDocPair(containerDoc: Doc, containerDataDoc: Opt, childDoc: Doc) { - if (!childDoc || !Doc.GetProto(childDoc)) { + if (!childDoc || childDoc instanceof Promise || !Doc.GetProto(childDoc)) { console.log("No, no, no!"); return { layout: childDoc, data: childDoc }; } -- cgit v1.2.3-70-g09d2