mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-02-07 15:10:45 +03:00
Avoid persisting the selected action between sessions (#1122)
* Avoid persisting the selected action between sessions * Create giant-oranges-report.md
This commit is contained in:
parent
14e4178d59
commit
ab3c0e29dc
7
.changeset/giant-oranges-report.md
Normal file
7
.changeset/giant-oranges-report.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
'@redux-devtools/app': patch
|
||||
'@redux-devtools/core': patch
|
||||
'remotedev-redux-devtools-extension': patch
|
||||
---
|
||||
|
||||
Avoid persisting the selected action index between sessions
|
|
@ -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,31 @@ 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