Skip to content

Commit 87aa8f6

Browse files
committed
fix(files): clear loadError on PDF success and fix streaming null-flash
- pdf-viewer: add setLoadError(null) in onLoadSuccess so the toolbar is not permanently hidden after a failed-then-successful PDF load - file-viewer: consolidate streaming-mode rendering so the debounce period (before rendering=true) shows a skeleton instead of null
1 parent a579b85 commit 87aa8f6

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/file-viewer.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,12 +230,10 @@ const IframePreview = memo(function IframePreview({
230230

231231
if (renderError) return <PreviewError label='PDF' error={renderError} />
232232

233-
if (rendering && !streamingBuffer) {
234-
return <div className='relative flex flex-1 overflow-hidden'>{PDF_PAGE_SKELETON}</div>
235-
}
236-
237233
if (streamingContent !== undefined) {
238-
if (!streamingSource) return null
234+
if (!streamingSource) {
235+
return <div className='relative flex flex-1 overflow-hidden'>{PDF_PAGE_SKELETON}</div>
236+
}
239237
return <PdfViewerCore key={streamingBufferSeq} source={streamingSource} filename={file.name} />
240238
}
241239

apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/pdf-viewer.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ export const PdfViewerCore = memo(function PdfViewerCore({ source, filename }: P
259259
onLoadSuccess={({ numPages }) => {
260260
setPageCount(numPages)
261261
setCurrentPage(1)
262+
setLoadError(null)
262263
setIsDocumentReady(true)
263264
}}
264265
onLoadError={(err) => {

0 commit comments

Comments
 (0)