mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-25 02:53:53 +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 actionsDenylist?: string | readonly string[];
|
||||||
readonly actionsAllowlist?: string | readonly string[];
|
readonly actionsAllowlist?: string | readonly string[];
|
||||||
serialize?: boolean | SerializeWithImmutable;
|
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 stateSanitizer?: <S>(state: S, index?: number) => S;
|
||||||
readonly actionSanitizer?: <A extends Action<unknown>>(
|
readonly actionSanitizer?: <A extends Action<unknown>>(
|
||||||
action: A,
|
action: A,
|
||||||
|
@ -202,14 +197,7 @@ function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
|
||||||
const localFilter = getLocalFilter(config);
|
const localFilter = getLocalFilter(config);
|
||||||
const serializeState = getSerializeParameter(config);
|
const serializeState = getSerializeParameter(config);
|
||||||
const serializeAction = getSerializeParameter(config);
|
const serializeAction = getSerializeParameter(config);
|
||||||
let {
|
let { stateSanitizer, actionSanitizer, predicate, latency = 500 } = config;
|
||||||
statesFilter,
|
|
||||||
actionsFilter,
|
|
||||||
stateSanitizer,
|
|
||||||
actionSanitizer,
|
|
||||||
predicate,
|
|
||||||
latency = 500,
|
|
||||||
} = config;
|
|
||||||
|
|
||||||
// Deprecate actionsWhitelist and actionsBlacklist
|
// Deprecate actionsWhitelist and actionsBlacklist
|
||||||
if (config.actionsWhitelist) {
|
if (config.actionsWhitelist) {
|
||||||
|
@ -219,16 +207,6 @@ function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
|
||||||
deprecateParam('actionsBlacklist', 'actionsDenylist');
|
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(
|
const relayState = throttle(
|
||||||
(
|
(
|
||||||
liftedState?: LiftedState<S, A, unknown> | undefined,
|
liftedState?: LiftedState<S, A, unknown> | undefined,
|
||||||
|
|
|
@ -182,7 +182,6 @@ describe('Redux enhancer', () => {
|
||||||
counter,
|
counter,
|
||||||
window.__REDUX_DEVTOOLS_EXTENSION__({
|
window.__REDUX_DEVTOOLS_EXTENSION__({
|
||||||
actionsDenylist: ['SOME_ACTION'],
|
actionsDenylist: ['SOME_ACTION'],
|
||||||
statesFilter: (state) => state,
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
expect(typeof window.store).toBe('object');
|
expect(typeof window.store).toBe('object');
|
||||||
|
|
|
@ -20,23 +20,23 @@ export function arrToRegex(v: string | string[]) {
|
||||||
|
|
||||||
function filterActions(
|
function filterActions(
|
||||||
actionsById: { [actionId: number]: PerformAction<Action<unknown>> },
|
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) => ({
|
return mapValues(actionsById, (action, id: number) => ({
|
||||||
...action,
|
...action,
|
||||||
action: actionsFilter(action.action, id),
|
action: actionSanitizer(action.action, id),
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
function filterStates(
|
function filterStates(
|
||||||
computedStates: { state: unknown; error?: string | undefined }[],
|
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) => ({
|
return computedStates.map((state, idx) => ({
|
||||||
...state,
|
...state,
|
||||||
state: statesFilter(state.state, idx),
|
state: stateSanitizer(state.state, idx),
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user