From ef9f29464b117409c82302c78ae2cc9a405c9c1f Mon Sep 17 00:00:00 2001 From: Sergey Lapin Date: Mon, 10 Aug 2015 23:21:38 +0300 Subject: [PATCH 1/2] Update devtools.js to make it able recompute states on action We think that this change is essential to make [redux-import-export-monitor](https://github.com/lapanoid/redux-import-export-monitor) --- src/devTools.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/devTools.js b/src/devTools.js index 78308614..3bf383ac 100644 --- a/src/devTools.js +++ b/src/devTools.js @@ -6,7 +6,8 @@ const ActionTypes = { SWEEP: 'SWEEP', TOGGLE_ACTION: 'TOGGLE_ACTION', JUMP_TO_STATE: 'JUMP_TO_STATE', - SET_MONITOR_STATE: 'SET_MONITOR_STATE' + SET_MONITOR_STATE: 'SET_MONITOR_STATE', + RECOMPUTE_STATES: 'RECOMPUTE_STATES' }; const INIT_ACTION = { @@ -141,6 +142,12 @@ function liftReducer(reducer, initialState) { case ActionTypes.SET_MONITOR_STATE: monitorState = liftedAction.monitorState; break; + case ActionTypes.RECOMPUTE_STATES: + stagedActions = liftedAction.stagedActions; + committedState = liftedAction.committedState; + currentStateIndex = stagedActions.length - 1; + skippedActions = {}; + break; default: break; } @@ -227,6 +234,13 @@ export const ActionCreators = { }, setMonitorState(monitorState) { return { type: ActionTypes.SET_MONITOR_STATE, monitorState }; + }, + recomputeStates(committedState, stagedActions) { + return { + type: ActionTypes.RECOMPUTE_STATES, + committedState, + stagedActions + }; } }; From f3f4d607621afb5c65fcebf63b4a92a28342e9d6 Mon Sep 17 00:00:00 2001 From: Dustan Kasten Date: Tue, 11 Aug 2015 12:54:31 -0400 Subject: [PATCH 2/2] ensure window exists for universal rendering --- src/react/LogMonitor.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/react/LogMonitor.js b/src/react/LogMonitor.js index 99691c9b..d710dcc4 100644 --- a/src/react/LogMonitor.js +++ b/src/react/LogMonitor.js @@ -3,7 +3,9 @@ import LogMonitorEntry from './LogMonitorEntry'; export default class LogMonitor { constructor() { - window.addEventListener('keydown', ::this.handleKeyPress); + if (typeof window !== 'undefined') { + window.addEventListener('keydown', ::this.handleKeyPress); + } } static propTypes = {