Repository: reduxjs/redux-toolkit
Pull request #410 (2020-03-05 05:56:51)

Ignore serializability of `meta.args` by default
Ignore `meta.args` by default in serializability checks, on the grounds that the user really isn't explicitly adding that to the action themselves and this can result in unexpected errors.

netlify[bot]: Deploy preview for *redux-starter-kit-docs* ready!

Built with commit 75c7b89dac386d1229fe4e849883f4acb9419e9a

https://deploy-preview-410--redux-starter-kit-docs.netlify.com
github-actions[bot]: **Size Change:** +40 B (0%) 

**Total Size:** 54.1 kB

| Filename | Size | Change | |
|:--- |:---:|:---:|:---:|
| `dist/redux-toolkit.cjs.development.js` | 9.96 kB | +7 B (0%) |  |
| `dist/redux-toolkit.cjs.production.min.js` | 3.69 kB | +9 B (0%) |  |
| `dist/redux-toolkit.esm.js` | 9.9 kB | +8 B (0%) |  |
| `dist/redux-toolkit.umd.js` | 21.1 kB | +7 B (0%) |  |
| `dist/redux-toolkit.umd.min.js` | 9.22 kB | +9 B (0%) |  |

<details><summary>ℹ️ <strong>View Unchanged</strong></summary>

| Filename | Size | Change | |
|:--- |:---:|:---:|:---:|
| `dist/index.js` | 149 B | 0 B |  |


</details>



<a href="https://github.com/preactjs/compressed-size-action"><sub>compressed-size-action</sub></a>
codesandbox[bot]: This pull request is automatically built and testable in [CodeSandbox](https://codesandbox.io).

  To see build info of the built libraries, click [here](https://ci.codesandbox.io/status/reduxjs/redux-toolkit/pr/410/builds/13400) or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 75c7b89dac386d1229fe4e849883f4acb9419e9a:

|Sandbox| Source |
|--|--|
|[reverent-snowflake-dovzj](https://codesandbox.io/s/reverent-snowflake-dovzj)| Configuration |
|[zealous-cray-8m7gk](https://codesandbox.io/s/zealous-cray-8m7gk)| Configuration |
|[morning-field-ucdt8](https://codesandbox.io/s/morning-field-ucdt8)| Configuration |


Patch:
diff --git a/src/serializableStateInvariantMiddleware.ts b/src/serializableStateInvariantMiddleware.ts
index a702ec92..978b0a7a 100644
--- a/src/serializableStateInvariantMiddleware.ts
+++ b/src/serializableStateInvariantMiddleware.ts
@@ -35,7 +35,7 @@ export function findNonSerializableValue(
   path: ReadonlyArray<string> = [],
   isSerializable: (value: unknown) => boolean = isPlain,
   getEntries?: (value: unknown) => [string, any][],
-  ignoredPaths: string[] = []
+  ignoredPaths: string[] = ['meta.args']
 ): NonSerializableValue | false {
   let foundNestedSerializable: NonSerializableValue | false
 


Test patch:
diff --git a/src/serializableStateInvariantMiddleware.test.ts b/src/serializableStateInvariantMiddleware.test.ts
index 5044f7da..9c3476f8 100644
--- a/src/serializableStateInvariantMiddleware.test.ts
+++ b/src/serializableStateInvariantMiddleware.test.ts
@@ -385,4 +385,27 @@ describe('serializableStateInvariantMiddleware', () => {
       (See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)"
     `)
   })
+
+  it('should not check serializability for meta.args by default', () => {
+    const badValue = new Map()
+
+    const reducer: Reducer = (state = 42, action) => {
+      return state
+    }
+
+    const serializableStateInvariantMiddleware = createSerializableStateInvariantMiddleware()
+
+    const store = configureStore({
+      reducer: {
+        testSlice: reducer
+      },
+      middleware: [serializableStateInvariantMiddleware]
+    })
+
+    store.dispatch({ type: 'testAction', meta: { args: { badValue } } })
+
+    const { log } = getLog()
+    expect(log).toBe('')
+    const q = 42
+  })
 })