mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-25 15:40:06 +03:00
Avoid persisting the selected action between sessions
This commit is contained in:
parent
14e4178d59
commit
2459886c84
|
@ -1,5 +1,6 @@
|
|||
import { SchemeName, ThemeName } from '@redux-devtools/ui';
|
||||
import { AuthStates, States } from 'socketcluster-client/lib/scclientsocket';
|
||||
import { REHYDRATE } from 'redux-persist';
|
||||
import {
|
||||
CHANGE_SECTION,
|
||||
CHANGE_THEME,
|
||||
|
@ -559,6 +560,11 @@ export interface ErrorAction {
|
|||
payload: string;
|
||||
}
|
||||
|
||||
interface ReduxPersistRehydrateAction {
|
||||
type: typeof REHYDRATE;
|
||||
payload: unknown;
|
||||
}
|
||||
|
||||
export type StoreActionWithoutUpdateStateOrLiftedAction =
|
||||
| ChangeSectionAction
|
||||
| ChangeThemeAction
|
||||
|
@ -594,7 +600,8 @@ export type StoreActionWithoutUpdateStateOrLiftedAction =
|
|||
| UpdateReportsAction
|
||||
| GetReportError
|
||||
| GetReportSuccess
|
||||
| ErrorAction;
|
||||
| ErrorAction
|
||||
| ReduxPersistRehydrateAction;
|
||||
|
||||
export type StoreActionWithoutUpdateState =
|
||||
| StoreActionWithoutUpdateStateOrLiftedAction
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { REHYDRATE } from 'redux-persist';
|
||||
import {
|
||||
MONITOR_ACTION,
|
||||
SELECT_MONITOR,
|
||||
|
@ -93,6 +94,28 @@ export function monitor(
|
|||
...state,
|
||||
dispatcherIsOpen: !state.dispatcherIsOpen,
|
||||
};
|
||||
case REHYDRATE:
|
||||
const rehydratedState = action.payload as {
|
||||
readonly monitor: MonitorState;
|
||||
} | undefined;
|
||||
if (!rehydratedState) return state;
|
||||
if (
|
||||
rehydratedState.monitor.monitorState &&
|
||||
(typeof rehydratedState.monitor.monitorState.selectedActionId ===
|
||||
'number' ||
|
||||
typeof rehydratedState.monitor.monitorState.startActionId ===
|
||||
'number')
|
||||
) {
|
||||
return {
|
||||
...rehydratedState.monitor,
|
||||
monitorState: {
|
||||
...rehydratedState.monitor.monitorState,
|
||||
selectedActionId: null,
|
||||
startActionId: null,
|
||||
},
|
||||
};
|
||||
}
|
||||
return rehydratedState.monitor;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user