From be3719bbbede85b4dd099f436b4f7d3bade157cb Mon Sep 17 00:00:00 2001 From: Tyler Schicke Date: Wed, 1 May 2019 23:49:23 -0400 Subject: Fixed treeview stuff --- src/client/views/collections/CollectionSubView.tsx | 6 ++++-- src/client/views/collections/CollectionTreeView.tsx | 9 ++------- 2 files changed, 6 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/CollectionSubView.tsx b/src/client/views/collections/CollectionSubView.tsx index 2c2d74302..bcbde24f0 100644 --- a/src/client/views/collections/CollectionSubView.tsx +++ b/src/client/views/collections/CollectionSubView.tsx @@ -13,7 +13,7 @@ import { CollectionVideoView } from "./CollectionVideoView"; import { Doc, Opt } from "../../../new_fields/Doc"; import { DocComponent } from "../DocComponent"; import { listSpec } from "../../../new_fields/Schema"; -import { Cast, PromiseValue } from "../../../new_fields/Types"; +import { Cast, PromiseValue, FieldValue } from "../../../new_fields/Types"; import { List } from "../../../new_fields/List"; import { DocServer } from "../../DocServer"; import { ObjectField } from "../../../new_fields/ObjectField"; @@ -48,7 +48,9 @@ export function CollectionSubView(schemaCtor: (doc: Doc) => T) { } get children() { - return Cast(this.props.Document[this.props.fieldKey], listSpec(Doc)); + //TODO tfs: This might not be what we want? + //This linter error can't be fixed because of how js arguments work, so don't switch this to filter(FieldValue) + return Cast(this.props.Document[this.props.fieldKey], listSpec(Doc), []).filter(doc => FieldValue(doc)); } @action diff --git a/src/client/views/collections/CollectionTreeView.tsx b/src/client/views/collections/CollectionTreeView.tsx index 2a620a5e6..f148c2b2f 100644 --- a/src/client/views/collections/CollectionTreeView.tsx +++ b/src/client/views/collections/CollectionTreeView.tsx @@ -102,9 +102,7 @@ class TreeView extends React.Component { if (!this._collapsed) { bulletType = BulletType.Collapsible; childElements =
    - {/* // bcz: should this work? - {children.map(value => )} */} - {children.map(value => )} + {children.map(value => )}
; } else bulletType = BulletType.Collapsed; @@ -135,10 +133,7 @@ export class CollectionTreeView extends CollectionSubView(Document) { let copyOnDrag = BoolCast(this.props.Document.copyDraggedItems, false); let childrenElement = !children ? (null) : (children.map(value => - //bcz: shouldn't this work? - I think value[Id] is undefined sometimes - // ) - ) - ); + )); return (