@@ -14,7 +14,16 @@ import { useQuery, QueryClient, UseQueryResult, QueryCache } from '../..'
14
14
15
15
describe ( 'useQuery' , ( ) => {
16
16
const queryCache = new QueryCache ( )
17
- const queryClient = new QueryClient ( { queryCache } )
17
+ const queryClient = new QueryClient ( {
18
+ queryCache,
19
+ defaultOptions : {
20
+ queries : {
21
+ notifyOnFetchChange : true ,
22
+ notifyOnStaleChange : true ,
23
+ notifyOnStatusChange : true ,
24
+ } ,
25
+ } ,
26
+ } )
18
27
19
28
it ( 'should return the correct types' , ( ) => {
20
29
const key = queryKey ( )
@@ -508,13 +517,15 @@ describe('useQuery', () => {
508
517
expect ( states [ 1 ] ) . toMatchObject ( { data : 'test' } )
509
518
} )
510
519
511
- it ( 'should not re-render when notifyOnStatusChange is false and the selected data did not change' , async ( ) => {
520
+ it ( 'should not re-render when notify flags are false and the selected data did not change' , async ( ) => {
512
521
const key = queryKey ( )
513
522
const states : UseQueryResult < string > [ ] = [ ]
514
523
515
524
function Page ( ) {
516
525
const state = useQuery ( key , ( ) => ( { name : 'test' } ) , {
517
526
select : data => data . name ,
527
+ notifyOnFetchChange : false ,
528
+ notifyOnStaleChange : false ,
518
529
notifyOnStatusChange : false ,
519
530
} )
520
531
@@ -1353,7 +1364,7 @@ describe('useQuery', () => {
1353
1364
expect ( fn ) . toHaveBeenCalledTimes ( 5 )
1354
1365
} )
1355
1366
1356
- it ( 'should not re-render when a query status changes and notifyOnStatusChange is false' , async ( ) => {
1367
+ it ( 'should not re-render when a query status changes and notify flags are false' , async ( ) => {
1357
1368
const key = queryKey ( )
1358
1369
const states : UseQueryResult < string > [ ] = [ ]
1359
1370
@@ -1366,6 +1377,8 @@ describe('useQuery', () => {
1366
1377
} ,
1367
1378
{
1368
1379
notifyOnStatusChange : false ,
1380
+ notifyOnFetchChange : false ,
1381
+ notifyOnStaleChange : false ,
1369
1382
}
1370
1383
)
1371
1384
0 commit comments