mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-22 22:19:48 +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';
|
||||
|
||||
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,
|
||||
startActionId: null,
|
||||
inspectedActionPath: [],
|
||||
|
@ -8,11 +32,10 @@ export const DEFAULT_STATE = {
|
|||
tabName: 'Diff',
|
||||
};
|
||||
|
||||
export function updateMonitorState(monitorState) {
|
||||
return { type: UPDATE_MONITOR_STATE, monitorState };
|
||||
}
|
||||
|
||||
function reduceUpdateState(state, action) {
|
||||
function reduceUpdateState(
|
||||
state: DevtoolsInspectorState,
|
||||
action: DevtoolsInspectorAction
|
||||
) {
|
||||
return action.type === UPDATE_MONITOR_STATE
|
||||
? {
|
||||
...state,
|
||||
|
@ -21,7 +44,11 @@ function reduceUpdateState(state, action) {
|
|||
: 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 {
|
||||
...reduceUpdateState(state, action),
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user