File tree Expand file tree Collapse file tree 1 file changed +7
-11
lines changed
packages/toolkit/src/query/core/buildMiddleware Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -75,15 +75,6 @@ export const buildInvalidationByTagsHandler: InternalHandlerBuilder = ({
75
75
}
76
76
}
77
77
78
- function hasPendingRequests (
79
- state : CombinedState < EndpointDefinitions , string , string >
80
- ) {
81
- return Object . values ( {
82
- ...state . queries ,
83
- ...state . mutations ,
84
- } ) . some ( ( x ) => x ?. status === QueryStatus . pending )
85
- }
86
-
87
78
function invalidateTags (
88
79
newTags : readonly FullTagDescription < string > [ ] ,
89
80
mwApi : SubMiddlewareApi
@@ -93,8 +84,13 @@ export const buildInvalidationByTagsHandler: InternalHandlerBuilder = ({
93
84
94
85
pendingTagInvalidations . push ( ...newTags )
95
86
96
- if ( ! state . config . invalidateImmediately && hasPendingRequests ( state ) ) {
97
- return
87
+ if ( ! state . config . invalidateImmediately ) {
88
+ const hasPendingRequests = Object . values ( {
89
+ ...state . queries ,
90
+ ...state . mutations ,
91
+ } ) . some ( ( x ) => x ?. status === QueryStatus . pending )
92
+
93
+ if ( hasPendingRequests ) return
98
94
}
99
95
100
96
const tags = pendingTagInvalidations
You can’t perform that action at this time.
0 commit comments