Skip to content

Commit f28d047

Browse files
committed
Improve import state functionality
1 parent a54c2bc commit f28d047

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/app/api/importState.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@ export default function importState(state, { deserializeState, deserializeAction
66
let preloadedState;
77
let nextLiftedState = parse(state);
88
if (nextLiftedState.payload) {
9-
if (nextLiftedState.preloadedState) preloadedState = parse(nextLiftedState.preloadedState);
10-
nextLiftedState = parse(nextLiftedState.payload);
9+
if (nextLiftedState.preloadedState) preloadedState = nextLiftedState.preloadedState;
10+
nextLiftedState = nextLiftedState.payload;
1111
}
1212
if (deserializeState) {
13-
nextLiftedState.computedStates = nextLiftedState.computedStates.map(computedState => ({
14-
...computedState,
15-
state: deserializeState(computedState.state)
16-
}));
13+
if (typeof nextLiftedState.computedStates !== 'undefined') {
14+
nextLiftedState.computedStates = nextLiftedState.computedStates.map(computedState => ({
15+
...computedState,
16+
state: deserializeState(computedState.state)
17+
}));
18+
}
1719
if (typeof nextLiftedState.committedState !== 'undefined') {
1820
nextLiftedState.committedState = deserializeState(nextLiftedState.committedState);
1921
}

src/browser/extension/background/logging.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function getReport(reportId, tabId, instanceId) {
1919
window.store.dispatch({
2020
type: LIFTED_ACTION,
2121
message: 'IMPORT',
22-
state: JSON.stringify({ payload, preloadedState }),
22+
state: `{"payload":${payload}, "preloadedState":${preloadedState}}`,
2323
id: tabId,
2424
instanceId
2525
});

0 commit comments

Comments
 (0)