File tree Expand file tree Collapse file tree
apps/mobile/src/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ async function resolvePreviewItem(
5353 }
5454 if ( ! ( "environmentId" in item ) ) return { source : { ...item , name } } ;
5555 // Refresh expired URLs before handing them to Quick Look or ACTION_VIEW, which retain them.
56- const url = await refreshAssetUrl ( item . environmentId , item . resource )
56+ const url = await refreshAssetUrl ( item . environmentId , item . resource , signal )
5757 . then ( ( value ) => {
5858 if ( ! value ) throw new Error ( "Reconnect to this environment and try again." ) ;
5959 return value ;
Original file line number Diff line number Diff line change @@ -18,7 +18,17 @@ const preparedPdfAtom = Atom.family((uri: string) =>
1818 // stays interruptible so closing the viewer aborts the download.
1919 Effect . acquireRelease (
2020 Effect . tryPromise ( {
21- try : ( signal ) => preparePdfPreview ( uri , signal ) ,
21+ try : ( signal ) => {
22+ const prepared = preparePdfPreview ( uri , signal ) ;
23+ // An interrupt can land after the copy exists but before acquireRelease owns it.
24+ signal . addEventListener ( "abort" , ( ) => {
25+ void prepared . then (
26+ ( file ) => file ?. dispose ( ) ,
27+ ( ) => undefined ,
28+ ) ;
29+ } ) ;
30+ return prepared ;
31+ } ,
2232 catch : ( cause ) => ( cause instanceof Error ? cause . message : "The PDF could not be loaded." ) ,
2333 } ) . pipe (
2434 Effect . flatMap ( ( file ) => ( file === null ? Effect . interrupt : Effect . succeed ( file ) ) ) ,
You can’t perform that action at this time.
0 commit comments