@@ -2412,6 +2412,7 @@ it("keeps a workspace PDF open across URL renewals and reloads it when the file
24122412 }
24132413} ) ;
24142414it ( "keeps a workspace image and its zoom across agent commands and reloads it when the file changes" , async ( ) => {
2415+ assetUrlState . mockReset ( ) ;
24152416 const { WorkspaceImagePreview } = await import ( "./FilePreviewPanel" ) ;
24162417 const original =
24172418 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="20"/>' ;
@@ -2472,6 +2473,39 @@ it("keeps a workspace image and its zoom across agent commands and reloads it wh
24722473 expect ( reloaded ?. getAttribute ( "src" ) ?. startsWith ( edited ) ) . toBe ( true ) ;
24732474 } ) ;
24742475} ) ;
2476+ it ( "retries a failed workspace image when its URL is renewed for the same file" , async ( ) => {
2477+ assetUrlState . mockReset ( ) ;
2478+ const { WorkspaceImagePreview } = await import ( "./FilePreviewPanel" ) ;
2479+ const preview = ( mutation : string ) => (
2480+ < WorkspaceImagePreview
2481+ environmentId = { EnvironmentId . make ( "test" ) }
2482+ threadRef = { { environmentId : EnvironmentId . make ( "test" ) , threadId : ThreadId . make ( "test" ) } }
2483+ draft = { false }
2484+ workspaceRoot = "/repo"
2485+ absolutePath = "/repo/screenshot.svg"
2486+ alt = "screenshot.svg"
2487+ workspaceMutationId = { mutation }
2488+ />
2489+ ) ;
2490+ assetUrlState . mockReturnValue ( {
2491+ _tag : "Success" ,
2492+ url : "data:image/svg+xml,broken" ,
2493+ expiresAt : 0 ,
2494+ fileRevision : "one" ,
2495+ } ) ;
2496+ await using screen = await render ( preview ( "first" ) ) ;
2497+ await expect . element ( screen . getByText ( "Unable to load image." ) ) . toBeVisible ( ) ;
2498+
2499+ assetUrlState . mockReturnValue ( {
2500+ _tag : "Success" ,
2501+ url : 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="20"/>#renewed' ,
2502+ expiresAt : 0 ,
2503+ fileRevision : "one" ,
2504+ } ) ;
2505+ await screen . rerender ( preview ( "second" ) ) ;
2506+ await expect . element ( screen . getByRole ( "button" , { name : "Zoom in" } ) ) . toBeEnabled ( ) ;
2507+ expect ( screen . container . textContent ) . not . toContain ( "Unable to load image." ) ;
2508+ } ) ;
24752509function planningPdf (
24762510 titles = [ "Quarterly outlook" , "Delivery milestones" , "Budget and risks" ] ,
24772511 firstHeight = 140 ,
0 commit comments