@@ -37,7 +37,7 @@ export interface RetryOptions {
37
37
* Callback to determine if a retry should be attempted.
38
38
* Return `true` for another retry and `false` to quit trying prematurely.
39
39
*/
40
- shouldRetry ?: ( error : FetchBaseQueryError , args : BaseQueryArg < BaseQueryFn > , extraArgs : {
40
+ retryCondition ?: ( error : FetchBaseQueryError , args : BaseQueryArg < BaseQueryFn > , extraArgs : {
41
41
attempt : number
42
42
maxRetries : number
43
43
baseQueryApi : BaseQueryApi
@@ -56,12 +56,12 @@ const retryWithBackoff: BaseQueryEnhancer<
56
56
RetryOptions ,
57
57
RetryOptions | void
58
58
> = ( baseQuery , defaultOptions ) => async ( args , api , extraOptions ) => {
59
- const defaultShouldRetry : Exclude < RetryOptions [ 'shouldRetry ' ] , undefined > = ( _ , __ , { attempt, maxRetries} ) => attempt <= maxRetries
59
+ const defaultRetryCondition : Exclude < RetryOptions [ 'retryCondition ' ] , undefined > = ( _ , __ , { attempt, maxRetries} ) => attempt <= maxRetries
60
60
61
61
const options = {
62
62
maxRetries : 5 ,
63
63
backoff : defaultBackoff ,
64
- shouldRetry : defaultShouldRetry ,
64
+ retryCondition : defaultRetryCondition ,
65
65
...defaultOptions ,
66
66
...extraOptions ,
67
67
}
@@ -87,7 +87,7 @@ const retryWithBackoff: BaseQueryEnhancer<
87
87
throw e
88
88
}
89
89
90
- if ( e instanceof HandledError && ! options . shouldRetry ( e . value as FetchBaseQueryError , args , {
90
+ if ( e instanceof HandledError && ! options . retryCondition ( e . value as FetchBaseQueryError , args , {
91
91
attempt : retry ,
92
92
maxRetries : options . maxRetries ,
93
93
baseQueryApi : api ,
0 commit comments