From 747ae83d5b70b7e9b2d3755aa9e402dbf1c6ae5e Mon Sep 17 00:00:00 2001
From: usodhi <61431818+usodhi@users.noreply.github.com>
Date: Fri, 12 Jun 2020 18:31:49 +0530
Subject: fixed gridflex bugs

---
 .../views/collections/collectionGrid/CollectionGridView.tsx       | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

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

diff --git a/src/client/views/collections/collectionGrid/CollectionGridView.tsx b/src/client/views/collections/collectionGrid/CollectionGridView.tsx
index ec142f7a5..87d7d945a 100644
--- a/src/client/views/collections/collectionGrid/CollectionGridView.tsx
+++ b/src/client/views/collections/collectionGrid/CollectionGridView.tsx
@@ -65,9 +65,9 @@ export class CollectionGridView extends CollectionSubView(GridSchema) {
                 // for each document that was added, add a corresponding grid layout object
                 newValue.forEach(({ layout }, i) => {
                     if (!layouts.find(gridLayout => gridLayout.i === layout[Id])) {
-                        this.addLayoutItem(layouts, this.makeLayoutItem(layout, this.unflexedPosition(i), !this.flexGrid))
+                        this.addLayoutItem(layouts, this.makeLayoutItem(layout, this.unflexedPosition(i), !this.flexGrid));
                     }
-                })
+                });
             } else {
                 // for each document that was removed, remove its corresponding grid layout object
                 oldValue.forEach(({ layout }) => {
@@ -94,10 +94,12 @@ export class CollectionGridView extends CollectionSubView(GridSchema) {
         this._resetListenerDisposer?.();
     }
 
-    unflexedPosition(index: number) {
+    unflexedPosition(index: number): Omit<Layout, "i"> {
         return {
             x: (index % Math.floor(this.numCols / this.defaultW)) * this.defaultW,
             y: Math.floor(index / Math.floor(this.numCols / this.defaultH)) * this.defaultH,
+            w: this.defaultW,
+            h: this.defaultH,
             static: true
         };
     }
-- 
cgit v1.2.3-70-g09d2

