From bf668d63474ca6ba422f356c5a248f46abd87169 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sun, 18 Apr 2021 11:34:11 -0700 Subject: [PATCH] fix: Double documents.info request loading public share links --- app/scenes/Document/components/DataLoader.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/scenes/Document/components/DataLoader.js b/app/scenes/Document/components/DataLoader.js index c39e7c789..b65d1ac46 100644 --- a/app/scenes/Document/components/DataLoader.js +++ b/app/scenes/Document/components/DataLoader.js @@ -8,6 +8,7 @@ import * as React from "react"; import type { RouterHistory, Match } from "react-router-dom"; import { withRouter } from "react-router-dom"; import parseDocumentSlug from "shared/utils/parseDocumentSlug"; +import AuthStore from "stores/AuthStore"; import DocumentsStore from "stores/DocumentsStore"; import PoliciesStore from "stores/PoliciesStore"; import RevisionsStore from "stores/RevisionsStore"; @@ -33,6 +34,7 @@ type Props = {| documents: DocumentsStore, policies: PoliciesStore, revisions: RevisionsStore, + auth: AuthStore, ui: UiStore, history: RouterHistory, |}; @@ -57,7 +59,12 @@ class DataLoader extends React.Component { const document = this.document; const policy = this.props.policies.get(document.id); - if (!policy && !this.error) { + if ( + !policy && + !this.error && + this.props.auth.user && + this.props.auth.user.id + ) { this.loadDocument(); } }