From b18d4d2b9a4a624e61116642d4dbfe9a53437d0c Mon Sep 17 00:00:00 2001 From: bobzel Date: Fri, 12 Mar 2021 22:18:10 -0500 Subject: prevent anything but Docs from being written to offScreenTabs. fixed tabs to activate an unrendered tab when it is uncovered for the first time. --- src/client/views/collections/CollectionDockingView.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/client/views/collections/CollectionDockingView.tsx') diff --git a/src/client/views/collections/CollectionDockingView.tsx b/src/client/views/collections/CollectionDockingView.tsx index 5da75b1b7..3556e74bc 100644 --- a/src/client/views/collections/CollectionDockingView.tsx +++ b/src/client/views/collections/CollectionDockingView.tsx @@ -372,16 +372,17 @@ export class CollectionDockingView extends CollectionSubView(doc => doc) { this.props.Document.dockingConfig = json; setTimeout(async () => { - const sublists = DocListCast(this.props.Document[this.props.fieldKey]); - const tabs = Cast(sublists[0], Doc, null); - const other = Cast(sublists[1], Doc, null); + const sublists = await DocListCastAsync(this.props.Document[this.props.fieldKey]); + const tabs = sublists && Cast(sublists[0], Doc, null); + const other = sublists && Cast(sublists[1], Doc, null); const tabdocs = await DocListCastAsync(tabs?.data); const otherdocs = await DocListCastAsync(other?.data); tabs && (Doc.GetProto(tabs).data = new List(docs)); const otherSet = new Set(); otherdocs?.filter(doc => !docs.includes(doc)).forEach(doc => otherSet.add(doc)); tabdocs?.filter(doc => !docs.includes(doc) && doc.type !== DocumentType.KVP).forEach(doc => otherSet.add(doc)); - other && (Doc.GetProto(other).data = new List(Array.from(otherSet.values()))); + const vals = Array.from(otherSet.values()).filter(val => val instanceof Doc).map(d => d as Doc).filter(d => d.type !== DocumentType.KVP); + other && (Doc.GetProto(other).data = new List(vals)); }, 0); } -- cgit v1.2.3-70-g09d2