Skip to content

v2.8.4

Compare
Choose a tag to compare
@zalmoxisus zalmoxisus released this 25 Oct 12:23
· 278 commits to master since this release

New serializeState and serializeAction parameters

  • serializeState (boolean or function or object) - specify how and what should be handled during serialization (useful if state is not plain object). Could be:
    • false - handle only circular references.

    • true - handle also dates, regexes, undefined, error objects, and functions.

    • function(key, value) - JSON replacer. Example of usage with mori data structures:

      const store = Redux.createStore(reducer, window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__({
        serializeState: (key, value) => (
          value && mori.isMap(value) ? mori.toJs(value) : value
        )
      }));
    • object ({ replacer: function, options: object }) - in addition to the replacer function, specify an options object, which contains date, regexe, undefined, error, and function keys. Fo each of them you can indicate whether to include (if set as true). For function key you can also specify a custom function which handles serialization. See jsan for more details. Example:

      const store = Redux.createStore(reducer, window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__({
        serializeState: { 
          options: {
           undefined: true,
           function: function(fn) { return fn.toString() }
          }
        }
      }));
  • serializeAction (boolean or function or object) - same as serializeState but used for actions payloads.

Misc

  • Removed support for serialize option. Data is always stringified now as the benchmark showd there's no performance gain without serialization.
  • Deprecated devToolsExtension.updateStore. Remove it and just use __REDUX_DEVTOOLS_EXTENSION_COMPOSE__ instead of the extension's store enhancer.
  • Fix regression issue from v2.8.2 (#208).