mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-26 07:59:48 +03:00
More changes
This commit is contained in:
parent
386d7ee786
commit
c80473329e
|
@ -37,6 +37,7 @@
|
||||||
"@redux-devtools/serialize": "^0.3.0",
|
"@redux-devtools/serialize": "^0.3.0",
|
||||||
"@redux-devtools/slider-monitor": "^2.0.0-8",
|
"@redux-devtools/slider-monitor": "^2.0.0-8",
|
||||||
"@redux-devtools/utils": "^1.0.0-6",
|
"@redux-devtools/utils": "^1.0.0-6",
|
||||||
|
"@types/jsan": "^3.1.2",
|
||||||
"jsan": "^3.1.13",
|
"jsan": "^3.1.13",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"react": "^16.14.0",
|
"react": "^16.14.0",
|
||||||
|
|
|
@ -6,6 +6,8 @@ import {
|
||||||
SerializeWithImmutable,
|
SerializeWithImmutable,
|
||||||
} from '../../browser/extension/inject/pageScript';
|
} from '../../browser/extension/inject/pageScript';
|
||||||
import Immutable from 'immutable';
|
import Immutable from 'immutable';
|
||||||
|
import { LiftedState } from '@redux-devtools/instrument';
|
||||||
|
import { Action } from 'redux';
|
||||||
|
|
||||||
function deprecate(param: string) {
|
function deprecate(param: string) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
|
@ -34,7 +36,12 @@ function isSerializeWithReviver(
|
||||||
return !!(serialize as SerializeWithImmutable).immutable;
|
return !!(serialize as SerializeWithImmutable).immutable;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function importState(
|
interface ParsedSerializedLiftedState {
|
||||||
|
readonly payload: string;
|
||||||
|
readonly preloadedState?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function importState<S, A extends Action<unknown>>(
|
||||||
state: string | undefined,
|
state: string | undefined,
|
||||||
{ deserializeState, deserializeAction, serialize }: Config
|
{ deserializeState, deserializeAction, serialize }: Config
|
||||||
) {
|
) {
|
||||||
|
@ -57,14 +64,24 @@ export default function importState(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let preloadedState;
|
const parsedSerializedLiftedState:
|
||||||
let nextLiftedState = parse(state);
|
| ParsedSerializedLiftedState
|
||||||
if (nextLiftedState.payload) {
|
| LiftedState<S, A, unknown> = parse(state) as
|
||||||
if (nextLiftedState.preloadedState) {
|
| ParsedSerializedLiftedState
|
||||||
preloadedState = parse(nextLiftedState.preloadedState);
|
| LiftedState<S, A, unknown>;
|
||||||
}
|
let preloadedState =
|
||||||
nextLiftedState = parse(nextLiftedState.payload);
|
'payload' in parsedSerializedLiftedState &&
|
||||||
}
|
parsedSerializedLiftedState.preloadedState
|
||||||
|
? (parse(parsedSerializedLiftedState.preloadedState) as S)
|
||||||
|
: undefined;
|
||||||
|
const nextLiftedState =
|
||||||
|
'payload' in parsedSerializedLiftedState
|
||||||
|
? (parse(parsedSerializedLiftedState.payload) as LiftedState<
|
||||||
|
S,
|
||||||
|
A,
|
||||||
|
unknown
|
||||||
|
>)
|
||||||
|
: parsedSerializedLiftedState;
|
||||||
if (deserializeState) {
|
if (deserializeState) {
|
||||||
deprecate('deserializeState');
|
deprecate('deserializeState');
|
||||||
if (typeof nextLiftedState.computedStates !== 'undefined') {
|
if (typeof nextLiftedState.computedStates !== 'undefined') {
|
||||||
|
|
|
@ -275,7 +275,11 @@ function getStackTrace(
|
||||||
}
|
}
|
||||||
|
|
||||||
function amendActionType<A extends Action<unknown>>(
|
function amendActionType<A extends Action<unknown>>(
|
||||||
action: A | StructuralPerformAction<A> | string,
|
action:
|
||||||
|
| A
|
||||||
|
| StructuralPerformAction<A>
|
||||||
|
| StructuralPerformAction<A>[]
|
||||||
|
| string,
|
||||||
config: Config,
|
config: Config,
|
||||||
toExcludeFromTrace: Function | undefined
|
toExcludeFromTrace: Function | undefined
|
||||||
): StructuralPerformAction<A> {
|
): StructuralPerformAction<A> {
|
||||||
|
@ -494,7 +498,7 @@ const liftListener =
|
||||||
type: 'DISPATCH',
|
type: 'DISPATCH',
|
||||||
payload: {
|
payload: {
|
||||||
type: 'IMPORT_STATE',
|
type: 'IMPORT_STATE',
|
||||||
...importState(message.state, config),
|
...importState<S, A>(message.state, config)!,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -614,7 +618,7 @@ export function connect(preConfig: Config) {
|
||||||
) => {
|
) => {
|
||||||
const message: InitMessage<S, A> = {
|
const message: InitMessage<S, A> = {
|
||||||
type: 'INIT',
|
type: 'INIT',
|
||||||
payload: stringify(state, config.serialize),
|
payload: stringify(state, config.serialize as Serialize | undefined),
|
||||||
instanceId: id,
|
instanceId: id,
|
||||||
source,
|
source,
|
||||||
};
|
};
|
||||||
|
|
|
@ -120,7 +120,7 @@ export interface ConfigWithExpandedMaxAge {
|
||||||
readonly features?: Features;
|
readonly features?: Features;
|
||||||
readonly type?: string;
|
readonly type?: string;
|
||||||
readonly getActionType?: <A extends Action<unknown>>(action: A) => A;
|
readonly getActionType?: <A extends Action<unknown>>(action: A) => A;
|
||||||
readonly actionCreators: {
|
readonly actionCreators?: {
|
||||||
readonly [key: string]: ActionCreator<Action<unknown>>;
|
readonly [key: string]: ActionCreator<Action<unknown>>;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -362,10 +362,10 @@ function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function importPayloadFrom(state) {
|
function importPayloadFrom(state: string | undefined) {
|
||||||
if (config.features && !config.features.import) return;
|
if (config!.features && !config!.features.import) return;
|
||||||
try {
|
try {
|
||||||
const nextLiftedState = importState(state, config);
|
const nextLiftedState = importState<S, A>(state, config!);
|
||||||
if (!nextLiftedState) return;
|
if (!nextLiftedState) return;
|
||||||
store.liftedStore.dispatch({ type: 'IMPORT_STATE', ...nextLiftedState });
|
store.liftedStore.dispatch({ type: 'IMPORT_STATE', ...nextLiftedState });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
"@redux-devtools/inspector-monitor": "^1.0.0",
|
"@redux-devtools/inspector-monitor": "^1.0.0",
|
||||||
"@types/es6template": "^1.0.0",
|
"@types/es6template": "^1.0.0",
|
||||||
"@types/history": "^4.7.8",
|
"@types/history": "^4.7.8",
|
||||||
"@types/jsan": "^3.1.0",
|
"@types/jsan": "^3.1.2",
|
||||||
"@types/lodash.shuffle": "^4.2.6",
|
"@types/lodash.shuffle": "^4.2.6",
|
||||||
"@types/object-path": "^0.11.0",
|
"@types/object-path": "^0.11.0",
|
||||||
"@types/react": "^16.14.8",
|
"@types/react": "^16.14.8",
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
"jsan": "^3.1.13"
|
"jsan": "^3.1.13"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jsan": "^3.1.0",
|
"@types/jsan": "^3.1.2",
|
||||||
"immutable": "^4.0.0-rc.12"
|
"immutable": "^4.0.0-rc.12"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
|
13
yarn.lock
13
yarn.lock
|
@ -3520,7 +3520,7 @@ __metadata:
|
||||||
"@redux-devtools/inspector-monitor": ^1.0.0
|
"@redux-devtools/inspector-monitor": ^1.0.0
|
||||||
"@types/es6template": ^1.0.0
|
"@types/es6template": ^1.0.0
|
||||||
"@types/history": ^4.7.8
|
"@types/history": ^4.7.8
|
||||||
"@types/jsan": ^3.1.0
|
"@types/jsan": ^3.1.2
|
||||||
"@types/lodash.shuffle": ^4.2.6
|
"@types/lodash.shuffle": ^4.2.6
|
||||||
"@types/object-path": ^0.11.0
|
"@types/object-path": ^0.11.0
|
||||||
"@types/prop-types": ^15.7.3
|
"@types/prop-types": ^15.7.3
|
||||||
|
@ -3682,7 +3682,7 @@ __metadata:
|
||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "@redux-devtools/serialize@workspace:packages/redux-devtools-serialize"
|
resolution: "@redux-devtools/serialize@workspace:packages/redux-devtools-serialize"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/jsan": ^3.1.0
|
"@types/jsan": ^3.1.2
|
||||||
immutable: ^4.0.0-rc.12
|
immutable: ^4.0.0-rc.12
|
||||||
jsan: ^3.1.13
|
jsan: ^3.1.13
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
|
@ -5246,10 +5246,10 @@ __metadata:
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@types/jsan@npm:^3.1.0":
|
"@types/jsan@npm:^3.1.2":
|
||||||
version: 3.1.0
|
version: 3.1.2
|
||||||
resolution: "@types/jsan@npm:3.1.0"
|
resolution: "@types/jsan@npm:3.1.2"
|
||||||
checksum: a0670d90e4bee7110504be73eefff9196b46235faf490062865136b1cbad4d3bac2adb9303e308c523f07716c026bb8e72a12ae7d47a948424d4ca4d7883587d
|
checksum: 2ff652807d6067bbc650aaefcda4e3c07b54ddfd7d72283d7c1f1892ad1e18e907b1bbdbee7d0a163efa9e8aed9af5fa9f4ed8e2f27243c46383d31e1181fc11
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
@ -23231,6 +23231,7 @@ fsevents@^1.2.7:
|
||||||
"@redux-devtools/serialize": ^0.3.0
|
"@redux-devtools/serialize": ^0.3.0
|
||||||
"@redux-devtools/slider-monitor": ^2.0.0-8
|
"@redux-devtools/slider-monitor": ^2.0.0-8
|
||||||
"@redux-devtools/utils": ^1.0.0-6
|
"@redux-devtools/utils": ^1.0.0-6
|
||||||
|
"@types/jsan": ^3.1.2
|
||||||
bestzip: ^2.2.0
|
bestzip: ^2.2.0
|
||||||
chromedriver: ^91.0.1
|
chromedriver: ^91.0.1
|
||||||
electron: ^13.1.2
|
electron: ^13.1.2
|
||||||
|
|
Loading…
Reference in New Issue
Block a user