@@ -126,6 +126,7 @@ export class ComposableFactory {
126126 cancellationToken = null ;
127127 }
128128 fetching . value = true ;
129+ cancellationToken = new AbortController ( ) ;
129130
130131 let customFilter : ( ( el : TDetails ) => boolean ) | undefined = undefined
131132
@@ -136,7 +137,6 @@ export class ComposableFactory {
136137 let actualArgs = args as unknown as TArgs ;
137138
138139 try {
139- cancellationToken = new AbortController ( ) ;
140140 entities . value = await method ( ...actualArgs , cancellationToken ) ;
141141 if ( apply ) apply ( entities )
142142 }
@@ -154,8 +154,8 @@ export class ComposableFactory {
154154 cancellationToken = null ;
155155 }
156156 fetching . value = true ;
157+ cancellationToken = new AbortController ( ) ;
157158 try {
158- cancellationToken = new AbortController ( ) ;
159159 entities . value = await method ( ...actualArgs , cancellationToken ) ;
160160 if ( apply ) apply ( entities )
161161 }
@@ -203,8 +203,8 @@ export class ComposableFactory {
203203 cancellationToken = null ;
204204 }
205205 getting . value = true ;
206+ cancellationToken = new AbortController ( ) ;
206207 try {
207- cancellationToken = new AbortController ( ) ;
208208 entity . value = await method ( ...args , cancellationToken ) ;
209209 if ( apply ) apply ( entity as Ref < TDetails > ) ;
210210 }
@@ -253,8 +253,8 @@ export class ComposableFactory {
253253 cancellationToken = null ;
254254 }
255255 creating . value = true ;
256+ cancellationToken = new AbortController ( ) ;
256257 try {
257- cancellationToken = new AbortController ( ) ;
258258 created . value = await method ( ...args , cancellationToken ) ;
259259 if ( apply ) apply ( created as Ref < TDetails > ) ;
260260 }
@@ -303,8 +303,8 @@ export class ComposableFactory {
303303 cancellationToken = null ;
304304 }
305305 updating . value = true ;
306+ cancellationToken = new AbortController ( ) ;
306307 try {
307- cancellationToken = new AbortController ( ) ;
308308 updated . value = await method ( ...args , cancellationToken ) ;
309309 if ( apply ) apply ( updated as Ref < TDetails > ) ;
310310 }
@@ -342,8 +342,8 @@ export class ComposableFactory {
342342 cancellationToken = null ;
343343 }
344344 removing . value = true ;
345+ cancellationToken = new AbortController ( ) ;
345346 try {
346- cancellationToken = new AbortController ( ) ;
347347 await method ( ...args , cancellationToken ) ;
348348 }
349349 finally {
0 commit comments