Uses the router to handle tab state
This commit is contained in:
31
src/components/documents/RelatedDocumentList.tsx
Normal file
31
src/components/documents/RelatedDocumentList.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
import { useDocument, useDocumentCache } from "@/context/document/hooks";
|
||||
import type { DocumentId, RelationshipType } from "@/lib/types";
|
||||
import { RelationshipList } from "../RelationshipList";
|
||||
import { Loader } from "../Loader";
|
||||
|
||||
export type Props = {
|
||||
documentId: DocumentId;
|
||||
relationshipType: RelationshipType;
|
||||
};
|
||||
|
||||
export function RelatedDocumentList({ documentId, relationshipType }: Props) {
|
||||
const { docResult } = useDocument(documentId);
|
||||
|
||||
const { cache } = useDocumentCache();
|
||||
|
||||
console.log(documentId, docResult, cache);
|
||||
|
||||
if (docResult?.type !== "ready") {
|
||||
return <Loader />;
|
||||
}
|
||||
|
||||
const doc = docResult.value.doc;
|
||||
|
||||
return (
|
||||
<RelationshipList
|
||||
key={relationshipType}
|
||||
root={doc}
|
||||
relationshipType={relationshipType}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user