aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionBaseView.tsx
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2019-04-22 22:21:51 -0400
committerBob Zeleznik <zzzman@gmail.com>2019-04-22 22:21:51 -0400
commitaa3bf8c34df0030a631a945673cfdfbcd6320a15 (patch)
tree3607c8c535ac36eaa34cc732898020d58cdcedff /src/client/views/collections/CollectionBaseView.tsx
parent39e25ccc9b382c2cab66c7de20a091d28800243f (diff)
fixing annotations on documents
Diffstat (limited to 'src/client/views/collections/CollectionBaseView.tsx')
-rw-r--r--src/client/views/collections/CollectionBaseView.tsx11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/client/views/collections/CollectionBaseView.tsx b/src/client/views/collections/CollectionBaseView.tsx
index eec01bb3f..540df82e7 100644
--- a/src/client/views/collections/CollectionBaseView.tsx
+++ b/src/client/views/collections/CollectionBaseView.tsx
@@ -93,16 +93,15 @@ export class CollectionBaseView extends React.Component<CollectionViewProps> {
if (curPage >= 0) {
doc.SetOnPrototype(KeyStore.AnnotationOn, this.props.Document);
}
- if (this.props.Document.Get(this.props.fieldKey) instanceof Field) {
- const value = this.props.Document.GetList(this.props.fieldKey, [] as Document[]);
- if (!this.createsCycle(doc, this.props.Document)) {
- if (!value.some(v => v.Id === doc.Id) || allowDuplicates) {
- value.push(doc);
+ this.props.Document.GetOrCreateAsync(this.props.fieldKey, ListField, (value: ListField<Document>) => {
+ if (value && !this.createsCycle(doc, this.props.Document)) {
+ if (!value.Data.some(v => v.Id === doc.Id) || allowDuplicates) {
+ value.Data.push(doc);
doc.SetNumber(KeyStore.ZoomBasis, this.props.Document.GetNumber(KeyStore.Scale, 1));
}
return true;
}
- }
+ });
// bcz: What is this code trying to do?
// else {
// let proto = props.Document.GetPrototype();