@@ -51,6 +51,7 @@ export class QueryObserver<
5151 private currentResultState ?: QueryState < TQueryData , TError >
5252 private previousQueryResult ?: QueryObserverResult < TData , TError >
5353 private initialDataUpdateCount : number
54+ private initialErrorUpdateCount : number
5455 private staleTimeoutId ?: number
5556 private refetchIntervalId ?: number
5657
@@ -63,6 +64,7 @@ export class QueryObserver<
6364 this . client = client
6465 this . options = options
6566 this . initialDataUpdateCount = 0
67+ this . initialErrorUpdateCount = 0
6668 this . bindMethods ( )
6769 this . setOptions ( options )
6870 }
@@ -409,8 +411,10 @@ export class QueryObserver<
409411 error : state . error ,
410412 errorUpdatedAt : state . errorUpdateCount ,
411413 failureCount : state . fetchFailureCount ,
412- isFetched : state . dataUpdateCount > 0 ,
413- isFetchedAfterMount : state . dataUpdateCount > this . initialDataUpdateCount ,
414+ isFetched : state . dataUpdateCount > 0 || state . errorUpdateCount > 0 ,
415+ isFetchedAfterMount :
416+ state . dataUpdateCount > this . initialDataUpdateCount ||
417+ state . errorUpdateCount > this . initialErrorUpdateCount ,
414418 isFetching,
415419 isLoadingError : status === 'error' && state . dataUpdatedAt === 0 ,
416420 isPlaceholderData,
@@ -489,6 +493,7 @@ export class QueryObserver<
489493 this . previousQueryResult = this . currentResult
490494 this . currentQuery = query
491495 this . initialDataUpdateCount = query . state . dataUpdateCount
496+ this . initialErrorUpdateCount = query . state . errorUpdateCount
492497
493498 const willFetch = prevQuery
494499 ? this . willFetchOptionally ( )
0 commit comments