mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-28 12:33:55 +03:00
Remove deprecated filter methods (#944)
This commit is contained in:
parent
39be59eebe
commit
de83aa1b45
|
@ -95,11 +95,6 @@ export interface ConfigWithExpandedMaxAge {
|
|||
readonly actionsDenylist?: string | readonly string[];
|
||||
readonly actionsAllowlist?: string | readonly string[];
|
||||
serialize?: boolean | SerializeWithImmutable;
|
||||
readonly statesFilter?: <S>(state: S, index?: number) => S;
|
||||
readonly actionsFilter?: <A extends Action<unknown>>(
|
||||
action: A,
|
||||
id?: number
|
||||
) => A;
|
||||
readonly stateSanitizer?: <S>(state: S, index?: number) => S;
|
||||
readonly actionSanitizer?: <A extends Action<unknown>>(
|
||||
action: A,
|
||||
|
@ -202,14 +197,7 @@ function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
|
|||
const localFilter = getLocalFilter(config);
|
||||
const serializeState = getSerializeParameter(config);
|
||||
const serializeAction = getSerializeParameter(config);
|
||||
let {
|
||||
statesFilter,
|
||||
actionsFilter,
|
||||
stateSanitizer,
|
||||
actionSanitizer,
|
||||
predicate,
|
||||
latency = 500,
|
||||
} = config;
|
||||
let { stateSanitizer, actionSanitizer, predicate, latency = 500 } = config;
|
||||
|
||||
// Deprecate actionsWhitelist and actionsBlacklist
|
||||
if (config.actionsWhitelist) {
|
||||
|
@ -219,16 +207,6 @@ function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
|
|||
deprecateParam('actionsBlacklist', 'actionsDenylist');
|
||||
}
|
||||
|
||||
// Deprecate statesFilter and actionsFilter
|
||||
if (statesFilter) {
|
||||
deprecateParam('statesFilter', 'stateSanitizer');
|
||||
stateSanitizer = statesFilter; // eslint-disable-line no-param-reassign
|
||||
}
|
||||
if (actionsFilter) {
|
||||
deprecateParam('actionsFilter', 'actionSanitizer');
|
||||
actionSanitizer = actionsFilter; // eslint-disable-line no-param-reassign
|
||||
}
|
||||
|
||||
const relayState = throttle(
|
||||
(
|
||||
liftedState?: LiftedState<S, A, unknown> | undefined,
|
||||
|
|
|
@ -182,7 +182,6 @@ describe('Redux enhancer', () => {
|
|||
counter,
|
||||
window.__REDUX_DEVTOOLS_EXTENSION__({
|
||||
actionsDenylist: ['SOME_ACTION'],
|
||||
statesFilter: (state) => state,
|
||||
})
|
||||
);
|
||||
expect(typeof window.store).toBe('object');
|
||||
|
|
|
@ -20,23 +20,23 @@ export function arrToRegex(v: string | string[]) {
|
|||
|
||||
function filterActions(
|
||||
actionsById: { [actionId: number]: PerformAction<Action<unknown>> },
|
||||
actionsFilter: ((action: Action<unknown>, id: number) => Action) | undefined
|
||||
actionSanitizer: ((action: Action<unknown>, id: number) => Action) | undefined
|
||||
) {
|
||||
if (!actionsFilter) return actionsById;
|
||||
if (!actionSanitizer) return actionsById;
|
||||
return mapValues(actionsById, (action, id: number) => ({
|
||||
...action,
|
||||
action: actionsFilter(action.action, id),
|
||||
action: actionSanitizer(action.action, id),
|
||||
}));
|
||||
}
|
||||
|
||||
function filterStates(
|
||||
computedStates: { state: unknown; error?: string | undefined }[],
|
||||
statesFilter: (state: unknown, actionId: number) => unknown
|
||||
stateSanitizer: (state: unknown, actionId: number) => unknown
|
||||
) {
|
||||
if (!statesFilter) return computedStates;
|
||||
if (!stateSanitizer) return computedStates;
|
||||
return computedStates.map((state, idx) => ({
|
||||
...state,
|
||||
state: statesFilter(state.state, idx),
|
||||
state: stateSanitizer(state.state, idx),
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user