From 207d23b94cad2e4d04f737d1144ca6bd2ab7d338 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Tue, 13 Feb 2024 23:17:44 -0800 Subject: [PATCH] make DocumentViewer actually client side --- src/app/document/view/[slug]/DocumentViewer.tsx | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/app/document/view/[slug]/DocumentViewer.tsx b/src/app/document/view/[slug]/DocumentViewer.tsx index 6bc1c35..e0a7a96 100644 --- a/src/app/document/view/[slug]/DocumentViewer.tsx +++ b/src/app/document/view/[slug]/DocumentViewer.tsx @@ -1,4 +1,4 @@ -import { DocumentType } from '@/app/db/data' +import { DocumentType, documents } from '@/app/db/data' import { Zilla_Slab } from 'next/font/google' import { epoch2datestring } from '@/app/utils/epoch2datestring' import { @@ -10,21 +10,11 @@ import { } from '@/app/components/DataDisplay' import { ItemBadge, Status } from '@/app/components/Badges' import Link from 'next/link' -import { useSuspenseQuery } from '@tanstack/react-query' -import { loadDocument } from '@/app/db/loaders' const zillaSlab = Zilla_Slab({ subsets: ['latin'], weight: ['500'] }) export default function DocumentViewer({ slug }: Readonly<{ slug: string }>) { - const { data, error } = useSuspenseQuery({ - queryKey: [slug], - queryFn: () => { - const data = loadDocument(slug) - return data - }, - }) - - const { manifest, abstract, file, citation } = data + const { manifest, abstract, file, citation } = documents[slug] const { title, authors, @@ -38,8 +28,6 @@ export default function DocumentViewer({ slug }: Readonly<{ slug: string }>) { status, } = manifest - if (error) throw error - return (