From ae07ba8fb410752ea98702219247ce5f89d1758b Mon Sep 17 00:00:00 2001
From: bob <bcz@cs.brown.edu>
Date: Fri, 19 Jul 2019 14:42:39 -0400
Subject: fixes for templates and stacking views

---
 src/client/views/collections/CollectionStackingView.tsx | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'src/client/views/collections/CollectionStackingView.tsx')

diff --git a/src/client/views/collections/CollectionStackingView.tsx b/src/client/views/collections/CollectionStackingView.tsx
index 4424cffe1..039bd7b3a 100644
--- a/src/client/views/collections/CollectionStackingView.tsx
+++ b/src/client/views/collections/CollectionStackingView.tsx
@@ -258,8 +258,9 @@ export class CollectionStackingView extends CollectionSubView(doc => doc) {
         let sectionFilter = StrCast(this.props.Document.sectionFilter);
         let fields = new Map<object, Doc[]>();
         sectionFilter && this.filteredChildren.map(d => {
-            if (!fields.has(d[sectionFilter] as object)) fields.set(d[sectionFilter] as object, [d]);
-            else fields.get(d[sectionFilter] as object)!.push(d);
+            let sectionValue = (d[sectionFilter] ? d[sectionFilter] : "-undefined-") as object;
+            if (!fields.has(sectionValue)) fields.set(sectionValue, [d]);
+            else fields.get(sectionValue)!.push(d);
         });
         return (
             <div className="collectionStackingView"
-- 
cgit v1.2.3-70-g09d2

