fix(13-03): dynamic import PreviewModal to prevent SSR DOMMatrix crash
react-pdf calls new DOMMatrix() at module level — static import causes 500 on document page during SSR. Same pattern as PdfViewer/PdfViewerWrapper. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
'use client';
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { PreviewModal } from './PreviewModal';
|
||||
import dynamic from 'next/dynamic';
|
||||
|
||||
// PreviewModal imports react-pdf which calls new DOMMatrix() at module level —
|
||||
// must be loaded client-only to avoid SSR crash, same pattern as PdfViewer.
|
||||
const PreviewModal = dynamic(() => import('./PreviewModal').then(m => m.PreviewModal), { ssr: false });
|
||||
|
||||
interface PreparePanelProps {
|
||||
docId: string;
|
||||
|
||||
Reference in New Issue
Block a user