From 301e7aef724a36926886659991c304da9c4d2b7c Mon Sep 17 00:00:00 2001
From: yipstanley <stanley_yip@brown.edu>
Date: Sun, 17 Mar 2019 15:05:56 -0400
Subject: updates

---
 src/client/views/collections/CollectionViewBase.tsx | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

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

diff --git a/src/client/views/collections/CollectionViewBase.tsx b/src/client/views/collections/CollectionViewBase.tsx
index 7cccfaf05..6725fc2d1 100644
--- a/src/client/views/collections/CollectionViewBase.tsx
+++ b/src/client/views/collections/CollectionViewBase.tsx
@@ -3,7 +3,7 @@ import { Document } from "../../../fields/Document";
 import { ListField } from "../../../fields/ListField";
 import React = require("react");
 import { KeyStore } from "../../../fields/KeyStore";
-import { FieldWaiting, Field } from "../../../fields/Field";
+import { FieldWaiting, Field, Opt } from "../../../fields/Field";
 import { undoBatch } from "../../util/UndoManager";
 import { DragManager } from "../../util/DragManager";
 import { DocumentView } from "../nodes/DocumentView";
@@ -11,6 +11,7 @@ import { Documents, DocumentOptions } from "../../documents/Documents";
 import { Key } from "../../../fields/Key";
 import { Transform } from "../../util/Transform";
 import { CollectionView } from "./CollectionView";
+import { NumberField } from "../../../fields/NumberField";
 
 export interface CollectionViewProps {
     fieldKey: Key;
@@ -51,11 +52,15 @@ export class CollectionViewBase extends React.Component<SubCollectionViewProps>
             let newDoc = docView ? docView.props.Document.CreateAlias() : doc.CreateAlias()
             de.data["newDoc"] = newDoc
             let oldDoc = docView ? docView.props.Document : doc
-            oldDoc.GetAsync(KeyStore.Width, (f: Field) => {
-                newDoc.Set(KeyStore.Width, f)
+            oldDoc.GetTAsync(KeyStore.Width, NumberField, (f: Opt<NumberField>) => {
+                if (f) {
+                    newDoc.SetNumber(KeyStore.Width, f.Data)
+                }
             })
-            oldDoc.GetAsync(KeyStore.Height, (f: Field) => {
-                newDoc.Set(KeyStore.Height, f)
+            oldDoc.GetTAsync(KeyStore.Height, NumberField, (f: Opt<NumberField>) => {
+                if (f) {
+                    newDoc.SetNumber(KeyStore.Height, f.Data)
+                }
             })
         }
 
@@ -68,7 +73,7 @@ export class CollectionViewBase extends React.Component<SubCollectionViewProps>
             if (!de.data["alias"]) {
                 this.props.removeDocument(doc)
             }
-            this.props.addDocument(doc)
+            this.props.addDocument(de.data["alias"] ? de.data["newDoc"] : doc)
         }
         e.stopPropagation();
     }
-- 
cgit v1.2.3-70-g09d2

