File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
src/utilities/subscriptions/urql Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @apollo/client " : patch
3+ ---
4+
5+ Fix in-flight multipart urql subscription cancellation
Original file line number Diff line number Diff line change @@ -35,7 +35,9 @@ export function createFetchMultipartSubscription(
3535 const currentFetch = preferredFetch || maybe ( ( ) => fetch ) || backupFetch ;
3636 const observerNext = observer . next . bind ( observer ) ;
3737
38- currentFetch ! ( uri , options )
38+ const abortController = new AbortController ( ) ;
39+
40+ currentFetch ! ( uri , { ...options , signal : abortController . signal } )
3941 . then ( ( response ) => {
4042 const ctype = response . headers ?. get ( "content-type" ) ;
4143
@@ -51,6 +53,10 @@ export function createFetchMultipartSubscription(
5153 . catch ( ( err : any ) => {
5254 handleError ( err , observer ) ;
5355 } ) ;
56+
57+ return ( ) => {
58+ abortController . abort ( ) ;
59+ } ;
5460 } ) ;
5561 } ;
5662}
You can’t perform that action at this time.
0 commit comments