aboutsummaryrefslogtreecommitdiff
path: root/src/new_fields/List.ts
diff options
context:
space:
mode:
authorSam Wilkins <abdullah_ahmed@brown.edu>2019-04-30 20:41:56 -0400
committerSam Wilkins <abdullah_ahmed@brown.edu>2019-04-30 20:41:56 -0400
commit7ab09794c9fe273eb2073c9c1565d85e5331fe8c (patch)
tree950141edde2e7faf49f030ea0de83d0897f3ea65 /src/new_fields/List.ts
parentee31019f719b46db57de486e66158e9600515edd (diff)
parentd2fb3085fe17a9c66eab893b2a3d000a5bdec054 (diff)
Merge branch 'newDocs' of https://github.com/browngraphicslab/Dash-Web into newDocs
Diffstat (limited to 'src/new_fields/List.ts')
-rw-r--r--src/new_fields/List.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/new_fields/List.ts b/src/new_fields/List.ts
index c1bd15cd1..3325302aa 100644
--- a/src/new_fields/List.ts
+++ b/src/new_fields/List.ts
@@ -1,5 +1,5 @@
import { Deserializable, autoObject } from "../client/util/SerializationHelper";
-import { Field, Update, Self } from "./Doc";
+import { Field, Update, Self, FieldResult } from "./Doc";
import { setter, getter, deleteProperty } from "./util";
import { serializable, alias, list } from "serializr";
import { observable, observe, IArrayChange, IArraySplice, IObservableArray, Lambda, reaction } from "mobx";
@@ -194,17 +194,17 @@ type ListUpdate<T> = ListSpliceUpdate<T> | ListIndexUpdate<T>;
class ListImpl<T extends Field> extends ObjectField {
constructor(fields: T[] = []) {
super();
- this.___fields = fields;
const list = new Proxy<this>(this, {
set: setter,
get: listGetter,
deleteProperty: deleteProperty,
defineProperty: () => { throw new Error("Currently properties can't be defined on documents using Object.defineProperty"); },
});
+ (list as any).push(...fields);
return list;
}
- [key: number]: T | null | undefined;
+ [key: number]: FieldResult<T>;
@serializable(alias("fields", list(autoObject())))
private get __fields() {
@@ -221,7 +221,7 @@ class ListImpl<T extends Field> extends ObjectField {
// @serializable(alias("fields", list(autoObject())))
@observable
- private ___fields: (T | null | undefined)[];
+ private ___fields: (T extends RefField ? ProxyField<T> : T)[] = [];
private [Update] = (diff: any) => {
// console.log(diff);