File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
src/ui/widgets/EmbeddedDisplay Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -78,14 +78,14 @@ export function useOpiFile(file: File): WidgetDescription {
7878 const [ contents , setContents ] = useState < WidgetDescription > ( EMPTY_WIDGET ) ;
7979
8080 useEffect ( ( ) => {
81- let isMounted = false ;
81+ let isMounted = true ;
8282 const fetchData = async ( ) : Promise < void > => {
8383 if ( fetchPromises . hasOwnProperty ( file . path ) ) {
8484 // This resource has been requested; once the cached
8585 // promise has been resolved the fileCache should be
8686 // populated.
8787 await fetchPromises [ file . path ] ;
88- if ( ! isMounted ) {
88+ if ( isMounted ) {
8989 setContents ( fileCache [ file . path ] ) ;
9090 }
9191 } else {
@@ -95,7 +95,7 @@ export function useOpiFile(file: File): WidgetDescription {
9595 const contents = await fetchPromise ;
9696 // Populate the file cache.
9797 fileCache [ file . path ] = contents ;
98- if ( ! isMounted ) {
98+ if ( isMounted ) {
9999 setContents ( contents ) ;
100100 }
101101 }
@@ -104,7 +104,7 @@ export function useOpiFile(file: File): WidgetDescription {
104104
105105 // Tidy up in case component is unmounted
106106 return ( ) => {
107- isMounted = true ;
107+ isMounted = false ;
108108 } ;
109109 } , [ file . path , file . defaultProtocol , fileExt ] ) ;
110110
You can’t perform that action at this time.
0 commit comments