File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -23,12 +23,13 @@ function manageDefaultContainer(setState: React.Dispatch<React.SetStateAction<El
2323}
2424
2525function manageAsyncContainer (
26- getContainer : ( ) => Promise < HTMLElement > ,
26+ getContainer : ( options : { abortSignal : AbortSignal } ) => Promise < HTMLElement > ,
2727 removeContainer : ( container : HTMLElement ) => void ,
2828 setState : React . Dispatch < React . SetStateAction < Element | null > >
2929) {
3030 let newContainer : HTMLElement ;
31- getContainer ( ) . then (
31+ const abortController = new AbortController ( ) ;
32+ getContainer ( { abortSignal : abortController . signal } ) . then (
3233 container => {
3334 newContainer = container ;
3435 setState ( container ) ;
@@ -38,6 +39,7 @@ function manageAsyncContainer(
3839 }
3940 ) ;
4041 return ( ) => {
42+ abortController . abort ( ) ;
4143 removeContainer ( newContainer ) ;
4244 } ;
4345}
You can’t perform that action at this time.
0 commit comments