Skip to content

Commit

Permalink
Only render the connected graph for non-bots (#393)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrhoads authored Sep 30, 2024
1 parent 944937a commit 05088fc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/app/doi.org/[...doi]/RelatedAggregateGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ import styles from "./RelatedAggregateGraph.module.scss"

interface Props {
doi: string
isBot?: boolean
}

export default async function RelatedAggregateGraph({ doi }: Props) {
export default async function RelatedAggregateGraph(props: Props) {
const { doi, isBot = false } = props
if (isBot) return null


const data = await getRelatedWorksGraph(doi)
const titleText = "Connections"
const emptyTitleText = "No connections"
Expand Down
5 changes: 2 additions & 3 deletions src/app/doi.org/[...doi]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export default async function Page({ params, searchParams }: Props) {
}



// Fetch DOI metadata
const { data } = await apolloClient.query<MetadataQueryData, MetadataQueryVar>({
query: DOI_METADATA_QUERY,
Expand All @@ -151,11 +152,9 @@ export default async function Page({ params, searchParams }: Props) {
<Suspense fallback={<Loading />}>
<Content variables={variables} isBot={JSON.parse(isBot)} />
</Suspense>

<Suspense>
<RelatedAggregateGraph doi={doi} />
<RelatedAggregateGraph doi={doi} isBot={JSON.parse(isBot)} />
</Suspense>

<RelatedContent variables={variables} showSankey={showSankey} connectionType={connectionType} isBot={JSON.parse(isBot)} />
<Script type="application/ld+json" id="schemaOrg">{data.work.schemaOrg}</Script>
</>
Expand Down

0 comments on commit 05088fc

Please sign in to comment.