aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTyler Schicke <tyler_schicke@brown.edu>2019-05-01 23:49:23 -0400
committerTyler Schicke <tyler_schicke@brown.edu>2019-05-01 23:49:23 -0400
commitbe3719bbbede85b4dd099f436b4f7d3bade157cb (patch)
tree9cabeebc5ed0342956f2a0b7aa7eab5c2a907b68 /src
parent6d52cfb2a7b2b575f448e7d7c3f02a97afa0027b (diff)
Fixed treeview stuff
Diffstat (limited to 'src')
-rw-r--r--src/client/views/collections/CollectionSubView.tsx6
-rw-r--r--src/client/views/collections/CollectionTreeView.tsx9
2 files changed, 6 insertions, 9 deletions
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<T>(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<TreeViewProps> {
if (!this._collapsed) {
bulletType = BulletType.Collapsible;
childElements = <ul>
- {/* // bcz: should this work?
- {children.map(value => <TreeView key={value[Id]} document={value} deleteDoc={this.remove} moveDocument={this.move} copyOnDrag={this.props.copyOnDrag} />)} */}
- {children.map(value => <TreeView key={value[Id] !== undefined ? value[Id] : Utils.GenerateGuid()} document={value} deleteDoc={this.remove} moveDocument={this.move} copyOnDrag={this.props.copyOnDrag} />)}
+ {children.map(value => <TreeView key={value[Id]} document={value} deleteDoc={this.remove} moveDocument={this.move} copyOnDrag={this.props.copyOnDrag} />)}
</ul >;
}
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
- // <TreeView document={value} key={value[Id]} deleteDoc={this.remove} moveDocument={this.props.moveDocument} copyOnDrag={copyOnDrag} />)
- <TreeView document={value} key={value[Id] !== undefined ? value[Id] : Utils.GenerateGuid()} deleteDoc={this.remove} moveDocument={this.props.moveDocument} copyOnDrag={copyOnDrag} />)
- );
+ <TreeView document={value} key={value[Id]} deleteDoc={this.remove} moveDocument={this.props.moveDocument} copyOnDrag={copyOnDrag} />));
return (
<div id="body" className="collectionTreeView-dropTarget"