From d818ef151ca65008e5c6bb5e92b709decb3026d8 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Mon, 14 Apr 2025 18:35:49 -0400
Subject: fixed how templates are expanded to avoid template sub-component
 conflicts by changing how field keys are named.   fixed various Cast
 functions to be more typesafe by including undefined as part of return type. 
 overhaul of Doc.MakeClone, MakeCopy, FindRefernces - makeClone is no longer
 async.  fixed inlined docs in text docs.

---
 src/client/views/DocComponent.tsx | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'src/client/views/DocComponent.tsx')

diff --git a/src/client/views/DocComponent.tsx b/src/client/views/DocComponent.tsx
index 45c80c6f7..1ecd82dbc 100644
--- a/src/client/views/DocComponent.tsx
+++ b/src/client/views/DocComponent.tsx
@@ -48,7 +48,7 @@ export function DocComponent<P extends DocComponentProps>() {
          * This Doc inherits from the dataDoc, and may or may not inherit (or be) the layoutDoc.
          */
         get rootDoc() {
-            return DocCast(this.Document.rootDocument, this.Document);
+            return DocCast(this.Document.rootDocument, this.Document)!;
         }
 
         /**
@@ -64,7 +64,7 @@ export function DocComponent<P extends DocComponentProps>() {
          * This may or may not inherit from the data doc.
          */
         @computed get layoutDoc() {
-            return this._props.LayoutTemplateString ? this.Document : Doc.Layout(this.Document, this._props.LayoutTemplate?.());
+            return this._props.LayoutTemplateString ? this.Document : Doc.LayoutDoc(this.Document, this._props.LayoutTemplate?.());
         }
 
         /**
@@ -115,7 +115,7 @@ export function ViewBoxBaseComponent<P extends FieldViewProps>() {
          *       consider: Document, layoutDoc, dataDoc
          */
         get rootDoc() {
-            return DocCast(this.Document.rootDocument, this.Document);
+            return DocCast(this.Document.rootDocument, this.Document)!;
         }
         /**
          * This is the document being rendered by the React component. In the
@@ -189,7 +189,7 @@ export function ViewBoxAnnotatableComponent<P extends FieldViewProps>() {
          *       other Doc options (Document, layoutDoc, dataDoc)
          */
         @computed get rootDoc() {
-            return DocCast(this.Document.rootDocument, this.Document);
+            return DocCast(this.Document.rootDocument, this.Document)!;
         }
         /**
          * This is the document being rendered.  It may be a template so it may or may no inherit from the data doc.
-- 
cgit v1.2.3-70-g09d2

