@@ -56,6 +56,7 @@ import { Atom } from "effect/reactivity";
5656import { deviceScreenKey , deviceStreamScreenAtom } from "../device/deviceStreamSession" ;
5757import type { PreviewStreamViewport } from "@t3tools/client-runtime/preview/server-browser-stream" ;
5858import { previewBridge } from "./previewBridge" ;
59+ import { PreviewUnreachable } from "./PreviewUnreachable" ;
5960import { showPreviewPopup } from "./showPreviewPopup" ;
6061import {
6162 clampPreviewMiniPlayerPosition ,
@@ -262,6 +263,7 @@ function BrowserMiniPlayer({ threadRef, tabId, miniPlayer }: Props & { readonly
262263 snapshot . navStatus . _tag === "Success"
263264 ? previewPdfAssetUrl ( snapshot . navStatus . url , httpBaseUrl )
264265 : null ;
266+ const loadFailed = snapshot . navStatus . _tag === "LoadFailed" ? snapshot . navStatus : null ;
265267 const poppedOut = serverTab ? serverPictureInPicture : Boolean ( desktopOverlay ?. pictureInPicture ) ;
266268 const canPopOut = serverTab
267269 ? poppedOut || ( pdfUrl === null && supportsServerPictureInPicture ( ) )
@@ -335,14 +337,23 @@ function BrowserMiniPlayer({ threadRef, tabId, miniPlayer }: Props & { readonly
335337 < >
336338 < BrowserSurfaceSlot
337339 tabId = { runtimeTabId }
338- visible = { Boolean ( desktopOverlay ?. hasWebContents ) }
340+ visible = { Boolean ( desktopOverlay ?. hasWebContents ) && ! loadFailed }
339341 cornerRadius = { PREVIEW_MINI_PLAYER_CORNER_RADIUS }
340342 zIndex = { PREVIEW_MINI_PLAYER_WEBVIEW_Z_INDEX }
341343 fitSourceContent
342344 layoutVersion = { `${ frame . x } :${ frame . y } ` }
343345 className = "absolute inset-0"
344346 />
345- { ! desktopOverlay ?. hasWebContents ? (
347+ { loadFailed ? (
348+ < div className = "pointer-events-auto absolute inset-0 z-[48] overflow-hidden rounded-[inherit]" >
349+ < PreviewUnreachable
350+ url = { loadFailed . url }
351+ code = { loadFailed . code }
352+ description = { loadFailed . description }
353+ onReload = { ( ) => void previewBridge ?. refresh ( runtimeTabId ) }
354+ />
355+ </ div >
356+ ) : ! desktopOverlay ?. hasWebContents ? (
346357 < div className = "pointer-events-none absolute inset-0 z-[49] flex items-center justify-center rounded-[inherit] bg-muted text-xs text-muted-foreground" >
347358 Reconnecting preview…
348359 </ div >
0 commit comments