mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-02-14 18:40:51 +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 { SchemeName, ThemeName } from '@redux-devtools/ui';
|
||||||
import { AuthStates, States } from 'socketcluster-client/lib/scclientsocket';
|
import { AuthStates, States } from 'socketcluster-client/lib/scclientsocket';
|
||||||
|
import { REHYDRATE } from 'redux-persist';
|
||||||
import {
|
import {
|
||||||
CHANGE_SECTION,
|
CHANGE_SECTION,
|
||||||
CHANGE_THEME,
|
CHANGE_THEME,
|
||||||
|
@ -559,6 +560,11 @@ export interface ErrorAction {
|
||||||
payload: string;
|
payload: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface ReduxPersistRehydrateAction {
|
||||||
|
type: typeof REHYDRATE;
|
||||||
|
payload: unknown;
|
||||||
|
}
|
||||||
|
|
||||||
export type StoreActionWithoutUpdateStateOrLiftedAction =
|
export type StoreActionWithoutUpdateStateOrLiftedAction =
|
||||||
| ChangeSectionAction
|
| ChangeSectionAction
|
||||||
| ChangeThemeAction
|
| ChangeThemeAction
|
||||||
|
@ -594,7 +600,8 @@ export type StoreActionWithoutUpdateStateOrLiftedAction =
|
||||||
| UpdateReportsAction
|
| UpdateReportsAction
|
||||||
| GetReportError
|
| GetReportError
|
||||||
| GetReportSuccess
|
| GetReportSuccess
|
||||||
| ErrorAction;
|
| ErrorAction
|
||||||
|
| ReduxPersistRehydrateAction;
|
||||||
|
|
||||||
export type StoreActionWithoutUpdateState =
|
export type StoreActionWithoutUpdateState =
|
||||||
| StoreActionWithoutUpdateStateOrLiftedAction
|
| StoreActionWithoutUpdateStateOrLiftedAction
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { REHYDRATE } from 'redux-persist';
|
||||||
import {
|
import {
|
||||||
MONITOR_ACTION,
|
MONITOR_ACTION,
|
||||||
SELECT_MONITOR,
|
SELECT_MONITOR,
|
||||||
|
@ -93,6 +94,31 @@ export function monitor(
|
||||||
...state,
|
...state,
|
||||||
dispatcherIsOpen: !state.dispatcherIsOpen,
|
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:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user