Fix PDF Viewer worker URL and restore default streaming behavior
All checks were successful
Automated Container Build / build-and-push (push) Successful in 28s

This commit is contained in:
Elijah 2026-05-31 22:07:30 -07:00
parent 3c47584bb2
commit 6ee6ef376c

View file

@ -7,9 +7,10 @@ import { useInView } from 'react-intersection-observer';
import 'react-pdf/dist/Page/AnnotationLayer.css';
import 'react-pdf/dist/Page/TextLayer.css';
if (typeof window !== 'undefined') {
pdfjs.GlobalWorkerOptions.workerSrc = `//unpkg.com/pdfjs-dist@${pdfjs.version}/build/pdf.worker.min.mjs`;
}
pdfjs.GlobalWorkerOptions.workerSrc = new URL(
'pdfjs-dist/build/pdf.worker.min.mjs',
import.meta.url,
).toString();
function LazyPage({ pageNumber, scale, containerWidth }: { pageNumber: number; scale: number; containerWidth: number }) {
const { ref, inView } = useInView({
@ -132,10 +133,6 @@ export default function PdfViewer({ url }: { url: string }) {
console.error('Failed to load PDF:', error);
setLoadError('Failed to load PDF file.');
}}
options={{
disableAutoFetch: true,
disableStream: true,
}}
loading={
<div className="flex flex-col items-center justify-center h-full mt-20 gap-3">
<Loader2 className="w-8 h-8 animate-spin" style={{ color: 'var(--color-accent)' }} />