mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-23 14:39:58 +03:00
stash
This commit is contained in:
parent
8b3cebc1cd
commit
35fc6ec837
|
@ -1 +1,2 @@
|
||||||
export default from './DevtoolsInspector';
|
import DevtoolsInspector from './DevtoolsInspector';
|
||||||
|
export default DevtoolsInspector;
|
||||||
|
|
|
@ -1,6 +1,30 @@
|
||||||
|
import { Action } from 'redux';
|
||||||
|
import { DevtoolsInspectorProps } from './DevtoolsInspector';
|
||||||
|
|
||||||
const UPDATE_MONITOR_STATE = '@@redux-devtools-inspector/UPDATE_MONITOR_STATE';
|
const UPDATE_MONITOR_STATE = '@@redux-devtools-inspector/UPDATE_MONITOR_STATE';
|
||||||
|
|
||||||
export const DEFAULT_STATE = {
|
interface UpdateMonitorStateAction {
|
||||||
|
type: typeof UPDATE_MONITOR_STATE;
|
||||||
|
monitorState: Partial<DevtoolsInspectorState>;
|
||||||
|
}
|
||||||
|
export function updateMonitorState(
|
||||||
|
monitorState: Partial<DevtoolsInspectorState>
|
||||||
|
): UpdateMonitorStateAction {
|
||||||
|
return { type: UPDATE_MONITOR_STATE, monitorState };
|
||||||
|
}
|
||||||
|
|
||||||
|
export type DevtoolsInspectorAction = UpdateMonitorStateAction;
|
||||||
|
|
||||||
|
export interface DevtoolsInspectorState {
|
||||||
|
selectedActionId: number | null;
|
||||||
|
startActionId: number | null;
|
||||||
|
inspectedActionPath: (string | number)[];
|
||||||
|
inspectedStatePath: (string | number)[];
|
||||||
|
tabName: string;
|
||||||
|
searchValue?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const DEFAULT_STATE: DevtoolsInspectorState = {
|
||||||
selectedActionId: null,
|
selectedActionId: null,
|
||||||
startActionId: null,
|
startActionId: null,
|
||||||
inspectedActionPath: [],
|
inspectedActionPath: [],
|
||||||
|
@ -8,11 +32,10 @@ export const DEFAULT_STATE = {
|
||||||
tabName: 'Diff',
|
tabName: 'Diff',
|
||||||
};
|
};
|
||||||
|
|
||||||
export function updateMonitorState(monitorState) {
|
function reduceUpdateState(
|
||||||
return { type: UPDATE_MONITOR_STATE, monitorState };
|
state: DevtoolsInspectorState,
|
||||||
}
|
action: DevtoolsInspectorAction
|
||||||
|
) {
|
||||||
function reduceUpdateState(state, action) {
|
|
||||||
return action.type === UPDATE_MONITOR_STATE
|
return action.type === UPDATE_MONITOR_STATE
|
||||||
? {
|
? {
|
||||||
...state,
|
...state,
|
||||||
|
@ -21,7 +44,11 @@ function reduceUpdateState(state, action) {
|
||||||
: state;
|
: state;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function reducer(props, state = DEFAULT_STATE, action) {
|
export function reducer<S, A extends Action<unknown>>(
|
||||||
|
props: DevtoolsInspectorProps<S, A>,
|
||||||
|
state = DEFAULT_STATE,
|
||||||
|
action: DevtoolsInspectorAction
|
||||||
|
) {
|
||||||
return {
|
return {
|
||||||
...reduceUpdateState(state, action),
|
...reduceUpdateState(state, action),
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user