@@ -70,7 +70,7 @@ It is preferable to use the chainable `.concat(...)` and `.prepend(...)` methods
7070
7171One of the goals of Redux Toolkit is to provide opinionated defaults and prevent common mistakes. As part of that,
7272` getDefaultMiddleware ` includes some middleware that are added ** in development builds of your app only** to
73- provide runtime checks for two common issues:
73+ provide runtime checks for three common issues:
7474
7575- [ Immutability check middleware] ( ./immutabilityMiddleware.mdx ) : deeply compares
7676 state values for mutations. It can detect mutations in reducers during a dispatch, and also mutations that occur between
@@ -82,13 +82,21 @@ provide runtime checks for two common issues:
8282 such as functions, Promises, Symbols, and other non-plain-JS-data values. When a non-serializable value is detected, a
8383 console error will be printed with the key path for where the non-serializable value was detected.
8484
85+ - [ Action creator check middleware] ( ./actionCreatorMiddleware.mdx ) : another custom middleware created specifically for use in Redux Toolkit.
86+ Identifies when an action creator was mistakenly dispatched without being called, and warns to console with the action type.
87+
8588In addition to these development tool middleware, it also adds [ ` redux-thunk ` ] ( https://github.com/reduxjs/redux-thunk )
8689by default, since thunks are the basic recommended side effects middleware for Redux.
8790
8891Currently, the return value is:
8992
9093``` js
91- const middleware = [thunk, immutableStateInvariant, serializableStateInvariant]
94+ const middleware = [
95+ actionCreatorInvariant,
96+ immutableStateInvariant,
97+ thunk,
98+ serializableStateInvariant,
99+ ]
92100```
93101
94102### Production
@@ -153,10 +161,15 @@ interface SerializableStateInvariantMiddlewareOptions {
153161 // See "Serializability Middleware" page for definition
154162}
155163
164+ interface ActionCreatorInvariantMiddlewareOptions {
165+ // See "Action Creator Middleware" page for definition
166+ }
167+
156168interface GetDefaultMiddlewareOptions {
157169 thunk? : boolean | ThunkOptions
158170 immutableCheck? : boolean | ImmutableStateInvariantMiddlewareOptions
159171 serializableCheck? : boolean | SerializableStateInvariantMiddlewareOptions
172+ actionCreatorCheck? : boolean | ActionCreatorInvariantMiddlewareOptions
160173}
161174
162175function getDefaultMiddleware<S = any >(
0 commit comments