Skip to content

Commit 7fa587e

Browse files
committed
Deprecate (de)serializeState / (de)serializeAction
Related to #278.
1 parent b03991c commit 7fa587e

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

docs/API/Arguments.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Use `window.__REDUX_DEVTOOLS_EXTENSION__([config])` or `window.__REDUX_DEVTOOLS_
1111
- **pauseActionType** (*string*) - if specified, whenever clicking on `Pause recording` button and there are actions in the history log, will add this action type. If not specified, will commit when paused. Default is `@@PAUSED`.
1212
- **shouldStartLocked** (*boolean*) - if specified as `true`, it will not allow any non-monitor actions to be dispatched till clicking on `Unlock changes` button. Default is `false`.
1313
- **shouldHotReload** *boolean* - if set to `false`, will not recompute the states on hot reloading (or on replacing the reducers). Default to `true`.
14-
- **deserializeState(state): transformedState** / **deserializeAction(action): transformedAction** (*function*) - optional transformation of state / action deserialized from debug session (useful if state is not plain object. Example: immutable-js state). *These are legacy parameters. Use `serialize` instead!*
14+
- **deserializeState(state): transformedState** / **deserializeAction(action): transformedAction** (*function*) - optional transformation of state / action deserialized from debug session (useful if state is not plain object. Example: immutable-js state). ***Deprecated**. Use `serialize` instead!*
1515
Example of usage:
1616

1717
```js

src/app/api/importState.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ import mapValues from 'lodash/mapValues';
22
import jsan from 'jsan';
33
import seralizeImmutable from 'remotedev-serialize/immutable/serialize';
44

5+
function deprecate(param) {
6+
console.warn(`\`${param}\` parameter for Redux DevTools Extension is deprecated. Use \`serialize\` parameter instead: https://github.com/zalmoxisus/redux-devtools-extension/releases/tag/v2.12.1`); // eslint-disable-line
7+
}
8+
59
export default function importState(state, { deserializeState, deserializeAction, serialize }) {
610
if (!state) return undefined;
711
let parse = jsan.parse;
@@ -20,6 +24,7 @@ export default function importState(state, { deserializeState, deserializeAction
2024
nextLiftedState = parse(nextLiftedState.payload);
2125
}
2226
if (deserializeState) {
27+
deprecate('deserializeState');
2328
if (typeof nextLiftedState.computedStates !== 'undefined') {
2429
nextLiftedState.computedStates = nextLiftedState.computedStates.map(computedState => ({
2530
...computedState,
@@ -34,6 +39,7 @@ export default function importState(state, { deserializeState, deserializeAction
3439
}
3540
}
3641
if (deserializeAction) {
42+
deprecate('deserializeAction');
3743
nextLiftedState.actionsById = mapValues(nextLiftedState.actionsById, liftedAction => ({
3844
...liftedAction,
3945
action: deserializeAction(liftedAction.action)

src/app/api/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ export function getSeralizeParameter(config, param) {
3939

4040
const value = config[param];
4141
if (typeof value === 'undefined') return undefined;
42+
console.warn(`\`${param}\` parameter for Redux DevTools Extension is deprecated. Use \`serialize\` parameter instead: https://github.com/zalmoxisus/redux-devtools-extension/releases/tag/v2.12.1`); // eslint-disable-line
43+
4244
if (typeof serializeState === 'boolean') return { options: value };
4345
if (typeof serializeState === 'function') return { replacer: value };
4446
return value;

0 commit comments

Comments
 (0)