Redux Toolkit serializableCheck middleware warning behavior
0 reputation · 02 Aug 2023, 01:14 UTC
Redux Toolkit's configureStore includes a default serializableCheck middleware designed to ensure that actions and state remain serializable. This is critical for maintaining features like time-travel debugging and state persistence.
While the middleware identifies non-serializable values—such as Date objects, Map, Set, or class instances—it currently issues console warnings rather than blocking the state update or throwing errors. This creates a discrepancy between the intent of the check and the actual state of the store, as the non-serializable data is still successfully committed to the state.
There is uncertainty regarding the optimal configuration for production environments where console warnings are often suppressed, yet the performance overhead of the runtime check remains.
- Does the
serializableCheckmiddleware provide a mechanism to escalate warnings to hard errors for specific environment builds? - How does the middleware's interaction with custom middleware order affect the detection of non-serializable payloads?