diff options
| author | Sam Wilkins <35748010+samwilkins333@users.noreply.github.com> | 2020-01-21 19:03:22 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-21 19:03:22 -0500 |
| commit | 6042b43ea190006ebe7f51bef7b9ae6d0770b233 (patch) | |
| tree | 3a52edc8083a472e3c74fb4b6ad63d8d13ce76ba /src/client/views/collections/CollectionSubView.tsx | |
| parent | 7fffe13954ed0113bf1b2f9318518d015dc63844 (diff) | |
| parent | 8a4a8212b024e2804596a08ea820be646c9a7c0f (diff) | |
Merge pull request #332 from browngraphicslab/facet_refactor
Facet refactor
Diffstat (limited to 'src/client/views/collections/CollectionSubView.tsx')
| -rw-r--r-- | src/client/views/collections/CollectionSubView.tsx | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/client/views/collections/CollectionSubView.tsx b/src/client/views/collections/CollectionSubView.tsx index 5f4ee3669..9357b0507 100644 --- a/src/client/views/collections/CollectionSubView.tsx +++ b/src/client/views/collections/CollectionSubView.tsx @@ -90,7 +90,15 @@ export function CollectionSubView<T>(schemaCtor: (doc: Doc) => T) { // to its children which may be templates. // If 'annotationField' is specified, then all children exist on that field of the extension document, otherwise, they exist directly on the data document under 'fieldKey' @computed get dataField() { - return this.props.annotationsKey ? (this.extensionDoc ? this.extensionDoc[this.props.annotationsKey] : undefined) : this.dataDoc[this.props.fieldKey]; + const { annotationsKey, fieldKey } = this.props; + const { extensionDoc, dataDoc } = this; + if (annotationsKey) { + if (extensionDoc) { + return extensionDoc[annotationsKey]; + } + return undefined; + } + return dataDoc[fieldKey]; } get childLayoutPairs(): { layout: Doc; data: Doc; }[] { |
