Skip to content

Commit c809a80

Browse files
committed
feat: upgrade pdf component
1 parent dc9ee89 commit c809a80

File tree

1 file changed

+13
-1
lines changed
  • templates/types/streaming/nextjs/app/components/ui/chat/widgets

1 file changed

+13
-1
lines changed

templates/types/streaming/nextjs/app/components/ui/chat/widgets/PdfDialog.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { PDFViewer, PdfFocusProvider } from "@llamaindex/pdf-viewer";
1+
import dynamic from "next/dynamic";
22
import { Button } from "../../button";
33
import {
44
Drawer,
@@ -16,6 +16,18 @@ export interface PdfDialogProps {
1616
trigger: React.ReactNode;
1717
}
1818

19+
// Dynamic imports for client-side rendering only
20+
const PDFViewer = dynamic(
21+
() => import("@llamaindex/pdf-viewer").then((module) => module.PDFViewer),
22+
{ ssr: false },
23+
);
24+
25+
const PdfFocusProvider = dynamic(
26+
() =>
27+
import("@llamaindex/pdf-viewer").then((module) => module.PdfFocusProvider),
28+
{ ssr: false },
29+
);
30+
1931
export default function PdfDialog(props: PdfDialogProps) {
2032
return (
2133
<Drawer direction="left">

0 commit comments

Comments
 (0)