diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/linking/LinkFollowBox.tsx | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/src/client/views/linking/LinkFollowBox.tsx b/src/client/views/linking/LinkFollowBox.tsx index f78446771..da04b1292 100644 --- a/src/client/views/linking/LinkFollowBox.tsx +++ b/src/client/views/linking/LinkFollowBox.tsx @@ -58,36 +58,18 @@ export class LinkFollowBox extends React.Component<FieldViewProps> { () => LinkFollowBox.destinationDoc, async newLinkDestination => { if (LinkFollowBox.destinationDoc && this.sourceView && this.sourceView.props.ContainingCollectionView) { - let colView = this.sourceView.props.ContainingCollectionView; - let colDoc = colView.props.Document; - let shouldReturn = true; + let colDoc = this.sourceView.props.ContainingCollectionView.props.Document; + runInAction(() => { this.canPan = false; }); if (colDoc.viewType && colDoc.viewType === 1) { //this means its in a freeform collection let docs = Cast(colDoc.data, listSpec(Doc), []); let aliases = await SearchUtil.GetViewsOfDocument(Doc.GetProto(LinkFollowBox.destinationDoc)); aliases.forEach(alias => { - let docs2 = docs; - let res = docs2.filter(doc => doc === alias); - if (res.length > 0) { - runInAction(() => { - this.canPan = true; - shouldReturn = false; - }); - } + if (docs.filter(doc => doc === alias).length > 0) { runInAction(() => { this.canPan = true; }); } }); - - if (shouldReturn) { - runInAction(() => { this.canPan = false; }); - } - } - else { - runInAction(() => { this.canPan = false; }); } } - else { - runInAction(() => { this.canPan = false; }); - } } ); } |