diff --git a/extension/src/app/api/importState.ts b/extension/src/app/api/importState.ts index ba2bc7d5..878763d6 100644 --- a/extension/src/app/api/importState.ts +++ b/extension/src/app/api/importState.ts @@ -1,4 +1,3 @@ -import mapValues from 'lodash/mapValues'; import jsan from 'jsan'; import seralizeImmutable from '@redux-devtools/serialize/lib/immutable/serialize'; import { @@ -9,13 +8,6 @@ import Immutable from 'immutable'; import { LiftedState } from '@redux-devtools/instrument'; import { Action } from 'redux'; -function deprecate(param: string) { - // eslint-disable-next-line no-console - 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` - ); -} - interface SerializeWithRequiredImmutable extends SerializeWithImmutable { readonly immutable: typeof Immutable; } @@ -43,7 +35,7 @@ interface ParsedSerializedLiftedState { export default function importState>( state: string | undefined, - { deserializeState, deserializeAction, serialize }: Config + { serialize }: Config ) { if (!state) return undefined; let parse = jsan.parse; @@ -82,35 +74,6 @@ export default function importState>( unknown >) : parsedSerializedLiftedState; - if (deserializeState) { - deprecate('deserializeState'); - if (typeof nextLiftedState.computedStates !== 'undefined') { - nextLiftedState.computedStates = nextLiftedState.computedStates.map( - (computedState) => ({ - ...computedState, - state: deserializeState(computedState.state), - }) - ); - } - if (typeof nextLiftedState.committedState !== 'undefined') { - nextLiftedState.committedState = deserializeState( - nextLiftedState.committedState - ); - } - if (typeof preloadedState !== 'undefined') { - preloadedState = deserializeState(preloadedState); - } - } - if (deserializeAction) { - deprecate('deserializeAction'); - nextLiftedState.actionsById = mapValues( - nextLiftedState.actionsById, - (liftedAction) => ({ - ...liftedAction, - action: deserializeAction(liftedAction.action), - }) - ); - } return { nextLiftedState, preloadedState }; } diff --git a/extension/src/app/api/index.ts b/extension/src/app/api/index.ts index 4128de21..08b036a2 100644 --- a/extension/src/app/api/index.ts +++ b/extension/src/app/api/index.ts @@ -76,10 +76,7 @@ export interface Serialize { readonly options?: Options | boolean; } -export function getSerializeParameter( - config: Config, - param?: 'serializeState' | 'serializeAction' -) { +export function getSerializeParameter(config: Config) { const serialize = config.serialize; if (serialize) { if (serialize === true) return { options: true }; @@ -109,16 +106,7 @@ export function getSerializeParameter( }; } - const value = config[param!]; - if (typeof value === 'undefined') return undefined; - // eslint-disable-next-line no-console - 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` - ); - - if (typeof value === 'boolean') return { options: value }; - if (typeof value === 'function') return { replacer: value }; - return value; + return undefined; } interface InitInstancePageScriptToContentScriptMessage { diff --git a/extension/src/app/stores/enhancerStore.ts b/extension/src/app/stores/enhancerStore.ts index 75d83cd6..e99ebad8 100644 --- a/extension/src/app/stores/enhancerStore.ts +++ b/extension/src/app/stores/enhancerStore.ts @@ -37,10 +37,6 @@ export default function configureStore< shouldStartLocked: config.shouldStartLocked, pauseActionType: config.pauseActionType || '@@PAUSED', }), - persistState( - getUrlParam('debug_session'), - config.deserializeState, - config.deserializeAction - ) + persistState(getUrlParam('debug_session')) )(next); } diff --git a/extension/src/browser/extension/inject/pageScript.ts b/extension/src/browser/extension/inject/pageScript.ts index eeb60aff..59658926 100644 --- a/extension/src/browser/extension/inject/pageScript.ts +++ b/extension/src/browser/extension/inject/pageScript.ts @@ -95,14 +95,6 @@ export interface ConfigWithExpandedMaxAge { readonly actionsDenylist?: string | readonly string[]; readonly actionsAllowlist?: string | readonly string[]; serialize?: boolean | SerializeWithImmutable; - readonly serializeState?: - | boolean - | ((key: string, value: unknown) => unknown) - | Serialize; - readonly serializeAction?: - | boolean - | ((key: string, value: unknown) => unknown) - | Serialize; readonly stateSanitizer?: (state: S, index?: number) => S; readonly actionSanitizer?: >( action: A, @@ -129,8 +121,6 @@ export interface ConfigWithExpandedMaxAge { readonly shouldRecordChanges?: boolean; readonly shouldStartLocked?: boolean; readonly pauseActionType?: unknown; - readonly deserializeState?: (state: S) => S; - readonly deserializeAction?: >(action: A) => A; name?: string; readonly autoPause?: boolean; readonly features?: Features; @@ -205,8 +195,8 @@ function __REDUX_DEVTOOLS_EXTENSION__>( let sendingActionId = 1; const instanceId = generateId(config.instanceId); const localFilter = getLocalFilter(config); - const serializeState = getSerializeParameter(config, 'serializeState'); - const serializeAction = getSerializeParameter(config, 'serializeAction'); + const serializeState = getSerializeParameter(config); + const serializeAction = getSerializeParameter(config); let { stateSanitizer, actionSanitizer, predicate, latency = 500 } = config; // Deprecate actionsWhitelist and actionsBlacklist diff --git a/extension/test/app/inject/enhancer.spec.js b/extension/test/app/inject/enhancer.spec.js index bf9b2406..49229474 100644 --- a/extension/test/app/inject/enhancer.spec.js +++ b/extension/test/app/inject/enhancer.spec.js @@ -182,7 +182,6 @@ describe('Redux enhancer', () => { counter, window.__REDUX_DEVTOOLS_EXTENSION__({ actionsDenylist: ['SOME_ACTION'], - serializeState: (key, value) => value, }) ); expect(typeof window.store).toBe('object'); diff --git a/packages/redux-devtools-utils/src/importState.ts b/packages/redux-devtools-utils/src/importState.ts index 709fec0c..a53ba3d7 100644 --- a/packages/redux-devtools-utils/src/importState.ts +++ b/packages/redux-devtools-utils/src/importState.ts @@ -1,4 +1,3 @@ -import mapValues from 'lodash/mapValues'; import jsan from 'jsan'; import { immutableSerialize } from '@redux-devtools/serialize'; import { Action } from 'redux'; @@ -11,23 +10,11 @@ interface State { committedState?: unknown; } -function deprecate(param: string) { - // eslint-disable-next-line no-console - 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' - ); -} - export default function importState( state: string, { - deserializeState, - deserializeAction, serialize, }: { - deserializeState?: (state: string) => unknown; - deserializeAction?: (action: string) => Action; serialize?: { immutable?: typeof Immutable; refs?: (new (data: any) => unknown)[] | null; @@ -83,37 +70,6 @@ export default function importState( ).payload ) as State; } - if (deserializeState) { - deprecate('deserializeState'); - if (typeof nextLiftedState.computedStates !== 'undefined') { - nextLiftedState.computedStates = nextLiftedState.computedStates.map( - (computedState) => ({ - ...computedState, - state: deserializeState(computedState.state as string), - }) - ); - } - if (typeof nextLiftedState.committedState !== 'undefined') { - nextLiftedState.committedState = deserializeState( - nextLiftedState.committedState as string - ); - } - if (typeof preloadedState !== 'undefined') { - preloadedState = deserializeState( - preloadedState as unknown as string - ) as State; - } - } - if (deserializeAction) { - deprecate('deserializeAction'); - nextLiftedState.actionsById = mapValues( - nextLiftedState.actionsById, - (liftedAction) => ({ - ...liftedAction, - action: deserializeAction(liftedAction.action as unknown as string), - }) - ); - } return { nextLiftedState, preloadedState }; }