File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
packages/query-core/src/__tests__ Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -996,7 +996,7 @@ describe('queryClient', () => {
996996 const key1 = queryKey ( )
997997 queryClient . setQueryData ( key1 , 'data' )
998998
999- void queryClient . fetchQuery ( {
999+ const pending = queryClient . fetchQuery ( {
10001000 queryKey : key1 ,
10011001 queryFn : ( ) => sleep ( 1000 ) . then ( ( ) => 'data2' ) ,
10021002 } )
@@ -1005,6 +1005,9 @@ describe('queryClient', () => {
10051005
10061006 await queryClient . cancelQueries ( )
10071007
1008+ // with previous data present, imperative fetch should resolve to that data after cancel
1009+ await expect ( pending ) . resolves . toBe ( 'data' )
1010+
10081011 const state1 = queryClient . getQueryState ( key1 )
10091012 expect ( state1 ) . toMatchObject ( {
10101013 data : 'data' ,
You can’t perform that action at this time.
0 commit comments