Skip to content
This repository was archived by the owner on Jun 5, 2020. It is now read-only.

Commit f5a9ab7

Browse files
committed
Fallback for redux-devtools-instrument < 1.5
1 parent 7d40aab commit f5a9ab7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/DevtoolsInspector.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { getBase16Theme } from 'react-base16-styling';
99
import { reducer, updateMonitorState } from './redux';
1010
import { ActionCreators } from 'redux-devtools';
1111

12-
const { commit, sweep, toggleAction, jumpToState } = ActionCreators;
12+
const { commit, sweep, toggleAction, jumpToAction, jumpToState } = ActionCreators;
1313

1414
function getLastActionId(props) {
1515
return props.stagedActionIds[props.stagedActionIds.length - 1];
@@ -191,8 +191,12 @@ export default class DevtoolsInspector extends Component {
191191
};
192192

193193
handleJumpToState = actionId => {
194-
const index = this.props.stagedActionIds.indexOf(actionId);
195-
if (index > 0) this.props.dispatch(jumpToState(index));
194+
if (jumpToAction) {
195+
this.props.dispatch(jumpToAction(actionId));
196+
} else { // Fallback for redux-devtools-instrument < 1.5
197+
const index = this.props.stagedActionIds.indexOf(actionId);
198+
if (index !== -1) this.props.dispatch(jumpToState(index));
199+
}
196200
};
197201

198202
handleCommit = () => {

0 commit comments

Comments
 (0)