From d1893911079abc7fdc4471097e20fc8d487f2725 Mon Sep 17 00:00:00 2001 From: BriannaVH Date: Thu, 6 Jul 2023 10:44:48 -0400 Subject: [PATCH] Dependencies no longer dissapear when a user clicks the link to another artifact --- app/src/components/DependencyCards.tsx | 6 +++--- app/src/pages/[resourceType]/[id].tsx | 12 ++++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/src/components/DependencyCards.tsx b/app/src/components/DependencyCards.tsx index dbdcec09..292c5935 100644 --- a/app/src/components/DependencyCards.tsx +++ b/app/src/components/DependencyCards.tsx @@ -1,5 +1,4 @@ import { - Anchor, ActionIcon, Center, createStyles, @@ -11,6 +10,7 @@ import { getBreakpointValue, rem } from '@mantine/core'; +import Link from 'next/link'; import React from 'react'; import { SquareArrowRight } from 'tabler-icons-react'; @@ -68,13 +68,13 @@ function Dependencies(props: { relatedArtifact: fhir4.RelatedArtifact }) { {dependencyInfo.type && ( - + {} - + )} diff --git a/app/src/pages/[resourceType]/[id].tsx b/app/src/pages/[resourceType]/[id].tsx index 99bf984e..0427d7b9 100644 --- a/app/src/pages/[resourceType]/[id].tsx +++ b/app/src/pages/[resourceType]/[id].tsx @@ -21,6 +21,7 @@ import Dependency from '@/components/DependencyCards'; export default function ResourceIDPage({ jsonData }: InferGetServerSidePropsType) { const resourceType = jsonData.resourceType; + const [activeTab, setActiveTab] = useState('json'); const [height, setWindowHeight] = useState(0); const decodedCql = useMemo(() => { @@ -48,7 +49,6 @@ export default function ResourceIDPage({ jsonData }: InferGetServerSidePropsType }; handleResize(); window.addEventListener('resize', handleResize); - return window.removeEventListener('resize', handleResize); }, []); const { @@ -81,6 +81,10 @@ export default function ResourceIDPage({ jsonData }: InferGetServerSidePropsType } ); + useEffect(() => { + setActiveTab('json'); + }, [jsonData.id]); + const draftMutation = trpc.draft.createDraft.useMutation({ onSuccess: data => { notifications.show({ @@ -133,7 +137,7 @@ export default function ResourceIDPage({ jsonData }: InferGetServerSidePropsType - + JSON {decodedElm != null && ELM} @@ -182,11 +186,11 @@ export default function ResourceIDPage({ jsonData }: InferGetServerSidePropsType - Number of Dependencies: {dataRequirements?.relatedArtifact.length} + Number of Dependencies: {dataRequirements.relatedArtifact.length} - {dataRequirements?.relatedArtifact.map((relatedArtifact, index) => ( + {dataRequirements.relatedArtifact.map((relatedArtifact, index) => ( ))}