diff options
| author | anika-ahluwalia <anika.ahluwalia@gmail.com> | 2020-09-02 01:36:29 -0500 |
|---|---|---|
| committer | anika-ahluwalia <anika.ahluwalia@gmail.com> | 2020-09-02 01:36:29 -0500 |
| commit | 13845edece4087447bf9817c250381e645ffe037 (patch) | |
| tree | 633c3e8671704906d9ab312a68dcf2ad47542c24 /src/client/views/collections/CollectionStackingView.tsx | |
| parent | ccfcbd7394dc643babc390797ffc3bea71d9f84c (diff) | |
| parent | 6f72743516e47a6ad077bb8e894c8005fee29fc7 (diff) | |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into anika_bug_fixes
Diffstat (limited to 'src/client/views/collections/CollectionStackingView.tsx')
| -rw-r--r-- | src/client/views/collections/CollectionStackingView.tsx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/client/views/collections/CollectionStackingView.tsx b/src/client/views/collections/CollectionStackingView.tsx index 04c464b73..e4bb8302f 100644 --- a/src/client/views/collections/CollectionStackingView.tsx +++ b/src/client/views/collections/CollectionStackingView.tsx @@ -344,9 +344,11 @@ export class CollectionStackingView extends CollectionSubView(StackingDocument) sectionStacking = (heading: SchemaHeaderField | undefined, docList: Doc[]) => { const key = this.pivotField; let type: "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" | undefined = undefined; - const types = docList.length ? docList.map(d => typeof d[key]) : this.filteredChildren.map(d => typeof d[key]); - if (types.map((i, idx) => types.indexOf(i) === idx).length === 1) { - type = types[0]; + if (this.pivotField) { + const types = docList.length ? docList.map(d => typeof d[key]) : this.filteredChildren.map(d => typeof d[key]); + if (types.map((i, idx) => types.indexOf(i) === idx).length === 1) { + type = types[0]; + } } const cols = () => this.isStackingView ? 1 : Math.max(1, Math.min(this.filteredChildren.length, Math.floor((this.props.PanelWidth() - 2 * this.xMargin) / (this.columnWidth + this.gridGap)))); @@ -364,10 +366,10 @@ export class CollectionStackingView extends CollectionSubView(StackingDocument) this.observer.observe(ref); } }} - key={heading ? heading.heading : ""} + key={heading?.heading ?? ""} cols={cols} headings={this.headings} - heading={heading ? heading.heading : ""} + heading={heading?.heading ?? ""} headingObject={heading} docList={docList} parent={this} |
