@@ -283,17 +283,12 @@ describe('PendingTasks Integration', () => {
283283 class TestComponent {
284284 query = injectQuery ( ( ) => ( {
285285 queryKey : [ 'component-query' ] ,
286- queryFn : async ( ) => {
287- await sleep ( 100 )
288- return 'component-data'
289- } ,
286+ queryFn : ( ) => sleep ( 100 ) . then ( ( ) => 'component-data' ) ,
290287 } ) )
291288
292289 mutation = injectMutation ( ( ) => ( {
293- mutationFn : async ( data : string ) => {
294- await sleep ( 100 )
295- return `processed: ${ data } `
296- } ,
290+ mutationFn : ( data : string ) =>
291+ sleep ( 100 ) . then ( ( ) => `processed: ${ data } ` ) ,
297292 } ) )
298293 }
299294
@@ -338,20 +333,14 @@ describe('PendingTasks Integration', () => {
338333 const query1 = TestBed . runInInjectionContext ( ( ) =>
339334 injectQuery ( ( ) => ( {
340335 queryKey : [ 'concurrent-1' ] ,
341- queryFn : async ( ) => {
342- await sleep ( 30 )
343- return 'data-1'
344- } ,
336+ queryFn : ( ) => sleep ( 30 ) . then ( ( ) => 'data-1' ) ,
345337 } ) ) ,
346338 )
347339
348340 const query2 = TestBed . runInInjectionContext ( ( ) =>
349341 injectQuery ( ( ) => ( {
350342 queryKey : [ 'concurrent-2' ] ,
351- queryFn : async ( ) => {
352- await sleep ( 50 )
353- return 'data-2'
354- } ,
343+ queryFn : ( ) => sleep ( 50 ) . then ( ( ) => 'data-2' ) ,
355344 } ) ) ,
356345 )
357346
@@ -385,19 +374,15 @@ describe('PendingTasks Integration', () => {
385374
386375 const mutation1 = TestBed . runInInjectionContext ( ( ) =>
387376 injectMutation ( ( ) => ( {
388- mutationFn : async ( data : string ) => {
389- await sleep ( 30 )
390- return `processed-1: ${ data } `
391- } ,
377+ mutationFn : ( data : string ) =>
378+ sleep ( 30 ) . then ( ( ) => `processed-1: ${ data } ` ) ,
392379 } ) ) ,
393380 )
394381
395382 const mutation2 = TestBed . runInInjectionContext ( ( ) =>
396383 injectMutation ( ( ) => ( {
397- mutationFn : async ( data : string ) => {
398- await sleep ( 50 )
399- return `processed-2: ${ data } `
400- } ,
384+ mutationFn : ( data : string ) =>
385+ sleep ( 50 ) . then ( ( ) => `processed-2: ${ data } ` ) ,
401386 } ) ) ,
402387 )
403388
@@ -436,19 +421,14 @@ describe('PendingTasks Integration', () => {
436421 const query = TestBed . runInInjectionContext ( ( ) =>
437422 injectQuery ( ( ) => ( {
438423 queryKey : [ 'mixed-query' ] ,
439- queryFn : async ( ) => {
440- await sleep ( 40 )
441- return 'query-data'
442- } ,
424+ queryFn : ( ) => sleep ( 40 ) . then ( ( ) => 'query-data' ) ,
443425 } ) ) ,
444426 )
445427
446428 const mutation = TestBed . runInInjectionContext ( ( ) =>
447429 injectMutation ( ( ) => ( {
448- mutationFn : async ( data : string ) => {
449- await sleep ( 60 )
450- return `mutation: ${ data } `
451- } ,
430+ mutationFn : ( data : string ) =>
431+ sleep ( 60 ) . then ( ( ) => `mutation: ${ data } ` ) ,
452432 } ) ) ,
453433 )
454434
@@ -561,10 +541,7 @@ describe('PendingTasks Integration', () => {
561541 const query = TestBed . runInInjectionContext ( ( ) =>
562542 injectQuery ( ( ) => ( {
563543 queryKey : [ 'cancel-test' ] ,
564- queryFn : async ( ) => {
565- await sleep ( 100 )
566- return 'data'
567- } ,
544+ queryFn : ( ) => sleep ( 100 ) . then ( ( ) => 'data' ) ,
568545 } ) ) ,
569546 )
570547
@@ -623,10 +600,7 @@ describe('PendingTasks Integration', () => {
623600
624601 const mutation = TestBed . runInInjectionContext ( ( ) =>
625602 injectMutation ( ( ) => ( {
626- mutationFn : async ( newData : string ) => {
627- await sleep ( 50 )
628- return newData
629- } ,
603+ mutationFn : ( newData : string ) => sleep ( 50 ) . then ( ( ) => newData ) ,
630604 onMutate : async ( newData ) => {
631605 // Optimistic update
632606 const previousData = queryClient . getQueryData ( testQueryKey )
0 commit comments