diff options
| author | Bob Zeleznik <zzzman@gmail.com> | 2019-04-22 23:02:55 -0400 |
|---|---|---|
| committer | Bob Zeleznik <zzzman@gmail.com> | 2019-04-22 23:02:55 -0400 |
| commit | 15c0430af0ded937ff5fe7f6fd3dc26eef791b97 (patch) | |
| tree | 4d39f0acd379ed025eebff926bd0e2ff0ef2a99d /src/client/views/collections/CollectionBaseView.tsx | |
| parent | 8dc47674365bb8fcff2cef0e91d26ff83923ecb8 (diff) | |
| parent | 45488acf628c5e1d598a79a38ef29cdb26889502 (diff) | |
Merge branch 'master' into leftbuttondominant
Diffstat (limited to 'src/client/views/collections/CollectionBaseView.tsx')
| -rw-r--r-- | src/client/views/collections/CollectionBaseView.tsx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/client/views/collections/CollectionBaseView.tsx b/src/client/views/collections/CollectionBaseView.tsx index eec01bb3f..b19f01350 100644 --- a/src/client/views/collections/CollectionBaseView.tsx +++ b/src/client/views/collections/CollectionBaseView.tsx @@ -93,16 +93,16 @@ 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; } - } + }); + return true; // bcz: What is this code trying to do? // else { // let proto = props.Document.GetPrototype(); |
