You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"This platform does not implement AbortController.
451
+
If you want to use the AbortController to react to \`abort\` events, please consider importing a polyfill like 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'."
Copy file name to clipboardExpand all lines: src/createAsyncThunk.ts
+29-1Lines changed: 29 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -167,6 +167,34 @@ export function createAsyncThunk<
167
167
}
168
168
)
169
169
170
+
letdisplayedWarning=false
171
+
172
+
constAC=
173
+
typeofAbortController!=='undefined'
174
+
? AbortController
175
+
: classimplementsAbortController{
176
+
signal: AbortSignal={
177
+
aborted: false,
178
+
addEventListener(){},
179
+
dispatchEvent(){
180
+
returnfalse
181
+
},
182
+
onabort(){},
183
+
removeEventListener(){}
184
+
}
185
+
abort(){
186
+
//if (process.env.NODE_ENV === 'development') {
187
+
if(!displayedWarning){
188
+
displayedWarning=true
189
+
console.info(
190
+
`This platform does not implement AbortController.
191
+
If you want to use the AbortController to react to \`abort\` events, please consider importing a polyfill like 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'.`
192
+
)
193
+
}
194
+
//}
195
+
}
196
+
}
197
+
170
198
functionactionCreator(arg: ThunkArg){
171
199
return(
172
200
dispatch: GetDispatch<ThunkApiConfig>,
@@ -175,7 +203,7 @@ export function createAsyncThunk<
0 commit comments