From 059efed253546fd922d2b7222a27ec7c74723af7 Mon Sep 17 00:00:00 2001 From: Richard R Date: Mon, 1 Jun 2026 05:09:18 -0600 Subject: [PATCH] refactor: remove initial loader state and related logic from PDFViewerPage --- src/app/(app)/pdf/[id]/page.tsx | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/src/app/(app)/pdf/[id]/page.tsx b/src/app/(app)/pdf/[id]/page.tsx index 4b1f9af..819e641 100644 --- a/src/app/(app)/pdf/[id]/page.tsx +++ b/src/app/(app)/pdf/[id]/page.tsx @@ -39,7 +39,6 @@ const PDFViewer = dynamic( ); const PARSE_LOADER_EXPAND_DELAY_MS = 320; -const INITIAL_LOADER_DELAY_MS = 180; export default function PDFViewerPage() { const canExportAudiobook = useFeatureFlag('enableAudiobookExport'); @@ -71,7 +70,6 @@ export default function PDFViewerPage() { const [activeSidebar, setActiveSidebar] = useState(null); const [showForceReparseConfirm, setShowForceReparseConfirm] = useState(false); const [showDetailedParseLoader, setShowDetailedParseLoader] = useState(false); - const [showInitialLoader, setShowInitialLoader] = useState(false); const [containerHeight, setContainerHeight] = useState('auto'); const inFlightDocIdRef = useRef(null); const loadedDocIdRef = useRef(null); @@ -92,7 +90,6 @@ export default function PDFViewerPage() { setIsPdfViewerReady(false); setError(null); setActiveSidebar(null); - setShowInitialLoader(false); inFlightDocIdRef.current = null; loadedDocIdRef.current = null; }, [id]); @@ -158,17 +155,6 @@ export default function PDFViewerPage() { useUnmountCleanupRef(clearCurrDoc); - useEffect(() => { - if (!isLoading) { - setShowInitialLoader(false); - return; - } - const timeout = window.setTimeout(() => { - setShowInitialLoader(true); - }, INITIAL_LOADER_DELAY_MS); - return () => window.clearTimeout(timeout); - }, [isLoading, id]); - useEffect(() => { if (isLoading) return; if (isParseReady) return; @@ -295,7 +281,6 @@ export default function PDFViewerPage() { : 0; const hasMeasuredProgress = totalPages > 0; const isMerging = parseProgress?.phase === 'merge'; - const compactProgressWidth = hasMeasuredProgress ? `${progressPercent}%` : '24%'; let statusText = 'Loading PDF...'; let statusSubText = 'Initializing document renderer'; @@ -380,11 +365,10 @@ export default function PDFViewerPage() { -
-
+
+ + +
)} @@ -439,7 +423,7 @@ export default function PDFViewerPage() { />
) : null} - {(!isLoading || showInitialLoader) && (isLoading || !isParseReady || !isPdfViewerReady) ? ( + {isLoading || !isParseReady || !isPdfViewerReady ? (
{renderPdfStatusLoader()}