@@ -249,7 +249,10 @@ export class QueryObserver<
249
249
this . staleTimeoutId = setTimeout ( ( ) => {
250
250
if ( ! this . currentResult . isStale ) {
251
251
this . updateResult ( )
252
- this . notify ( { listeners : true , cache : true } )
252
+ this . notify ( {
253
+ listeners : this . options . notifyOnStaleChange === true ,
254
+ cache : true ,
255
+ } )
253
256
}
254
257
} , timeout )
255
258
}
@@ -446,19 +449,11 @@ export class QueryObserver<
446
449
}
447
450
448
451
if (
449
- // Always notify on data or error changes
452
+ // Always notify if notifyOnStatusChange is set
453
+ this . options . notifyOnStatusChange !== false ||
454
+ // Otherwise only notify on data or error change
450
455
currentResult . data !== prevResult . data ||
451
- currentResult . error !== prevResult . error ||
452
- // Maybe notify on status change
453
- ( this . options . notifyOnStatusChange !== false &&
454
- currentResult . status !== prevResult . status ) ||
455
- // Maybe notify on fetch change
456
- ( this . options . notifyOnFetchChange !== false &&
457
- ( currentResult . isFetching !== prevResult . isFetching ||
458
- currentResult . failureCount !== prevResult . failureCount ) ) ||
459
- // Maybe notify on stale change
460
- ( this . options . notifyOnStaleChange &&
461
- currentResult . isStale !== prevResult . isStale )
456
+ currentResult . error !== prevResult . error
462
457
) {
463
458
notifyOptions . listeners = true
464
459
}
0 commit comments