aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionSubView.tsx
diff options
context:
space:
mode:
authorSam Wilkins <abdullah_ahmed@brown.edu>2019-05-04 18:59:30 -0400
committerSam Wilkins <abdullah_ahmed@brown.edu>2019-05-04 18:59:30 -0400
commitc9f3a1934548169ebe3c2e97968680ff339e304e (patch)
tree36140721e9a76bc212b28bc04f4662e96c7a2c1f /src/client/views/collections/CollectionSubView.tsx
parent1ccabe155cb4f23c0aa7e37f91cd4a303008b8c7 (diff)
initial commit - todo: use cursor field rather than generic tuple field
Diffstat (limited to 'src/client/views/collections/CollectionSubView.tsx')
-rw-r--r--src/client/views/collections/CollectionSubView.tsx9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/client/views/collections/CollectionSubView.tsx b/src/client/views/collections/CollectionSubView.tsx
index 828ac880a..1e8723fc6 100644
--- a/src/client/views/collections/CollectionSubView.tsx
+++ b/src/client/views/collections/CollectionSubView.tsx
@@ -17,6 +17,7 @@ import { Cast, PromiseValue, FieldValue } from "../../../new_fields/Types";
import { List } from "../../../new_fields/List";
import { DocServer } from "../../DocServer";
import { ObjectField } from "../../../new_fields/ObjectField";
+import { TupleField } from "../../../new_fields/TupleField";
export interface CollectionViewProps extends FieldViewProps {
addDocument: (document: Doc, allowDuplicates?: boolean) => boolean;
@@ -66,12 +67,12 @@ export function CollectionSubView<T>(schemaCtor: (doc: Doc) => T) {
if (!proto) {
return;
}
- let cursors = await Cast(proto.cursors, listSpec(ObjectField));
+ let cursors = await Cast(proto!.cursors, listSpec(TupleField));
if (!cursors) {
- proto.cursors = cursors = new List<ObjectField>();
+ proto!.cursors = cursors = new List<TupleField<[]>>();
}
- if (cursors.length > 0 && (ind = cursors.findIndex(entry => entry.Data[0][0] === id)) > -1) {
- cursors[ind].Data[1] = position;
+ if (cursors!.length > 0 && (ind = cursors!.findIndex(entry => entry.data[0][0] === id)) > -1) {
+ cursors![ind].data[1] = position;
} else {
let entry = new TupleField<[string, string], [number, number]>([textInfo, position]);
cursors.push(entry);