Skip to content

Commit 4770a35

Browse files
committed
2 parents 1c48edf + a15efc1 commit 4770a35

7 files changed

+72
-15
lines changed

Diff for: .babelrc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"stage": 0,
3-
"loose": "all"
2+
"plugins": ["transform-react-jsx"],
3+
"presets": ["es2015", "stage-0"]
44
}

Diff for: README.md

+49-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,58 @@
11
Redux DevTools Log Monitor
22
=========================
33

4-
The default monitor for [Redux DevTools](https://github.com/gaearon/redux-devtools).
5-
6-
**Note: this is a work-in-progress version for [Redux DevTools 3](https://github.com/gaearon/redux-devtools/pull/132), and will not work with stable devtools. It also requires React 0.14.**
4+
The default monitor for [Redux DevTools](https://github.com/gaearon/redux-devtools) with a tree view.
5+
It shows a log of states and actions, and lets you change their history.
76

87
![](http://i.imgur.com/J4GeW0M.gif)
98

9+
### Installation
10+
11+
```
12+
npm install --save-dev redux-devtools-log-monitor
13+
```
14+
15+
### Usage
16+
17+
You can use `LogMonitor` as the only monitor in your app:
18+
19+
##### `containers/DevTools.js`
20+
21+
```js
22+
import React from 'react';
23+
import { createDevTools } from 'redux-devtools';
24+
import LogMonitor from 'redux-devtools-log-monitor';
25+
26+
export default createDevTools(
27+
<LogMonitor />
28+
);
29+
```
30+
31+
Then you can render `<DevTools>` to any place inside app or even into a separate popup window.
32+
33+
Alternative, you can use it together with [`DockMonitor`](https://github.com/gaearon/redux-devtools-dock-monitor) to make it dockable.
34+
Consult the [`DockMonitor` README](https://github.com/gaearon/redux-devtools-dock-monitor) for details of this approach.
35+
36+
[Read how to start using Redux DevTools.](https://github.com/gaearon/redux-devtools)
37+
38+
### Features
39+
40+
Every action is displayed in the log. You can expand the tree view to inspect the `action` object and the `state` after it.
41+
42+
If a reducer throws while handling an action, you will see “Interrupted by an error up the chain” instead of the state and action tree view. Scroll up until you find the action which caused the error. You will see the error message in the action log entry. If you use a hot reloading tool, you can edit the reducer, and the error will automatically update or go away.
43+
44+
Clicking an action will disable it. It will appear crossed out, and the state will be recalculated as if the action never happened. Clicking it once again will enable it back. Use this together with a hot reloading solution to work sequentially on different states of your app without reproducing them by hand. You can toggle any action except for the initial one.
45+
46+
There are four buttons at the very top. “Reset” takes your app to the state you created the store with. The other three buttons work together. You might find it useful to think of them like you think of Git commits. “Commit” removes all actions in your log, and makes the current state your initial state. This is useful when you start working on a feature and want to remove the previous noise. After you’ve dispatched a few actions, you can press “Revert” to go back to the last committed state. Finally, if you dispatched some actions by mistake and you don’t want them around, you can toggle them by clicking on them, and press “Sweep” to completely remove all currently disabled actions from the log.
47+
48+
### Props
49+
50+
Name | Description
51+
------------- | -------------
52+
`theme` | Either a string referring to one of the themes provided by [redux-devtools-themes](https://github.com/gaearon/redux-devtools-themes) (feel free to contribute!) or a custom object of the same format. Optional. By default, set to [`'nicinabox'`](https://github.com/gaearon/redux-devtools-themes/blob/master/src/nicinabox.js).
53+
`select` | A function that selects the slice of the state for DevTools to show. For example, `state => state.thePart.iCare.about`. Optional. By default, set to `state => state`.
54+
`preserveScrollTop` | When `true`, records the current scroll top every second so it can be restored on refresh. This only has effect when used together with `persistState()` enhancer from Redux DevTools. By default, set to `true`.
55+
1056
### License
1157

1258
MIT

Diff for: package.json

+9-6
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"clean": "rimraf lib",
88
"build": "babel src --out-dir lib",
99
"lint": "eslint src test",
10-
"test": "NODE_ENV=test mocha --compilers js:babel/register --recursive",
11-
"test:watch": "NODE_ENV=test mocha --compilers js:babel/register --recursive --watch",
10+
"test": "NODE_ENV=test mocha --compilers js:babel-core/register --recursive",
11+
"test:watch": "NODE_ENV=test mocha --compilers js:babel-core/register --recursive --watch",
1212
"prepublish": "npm run lint && npm run test && npm run clean && npm run build"
1313
},
1414
"repository": {
@@ -31,10 +31,13 @@
3131
},
3232
"homepage": "https://github.com/gaearon/redux-devtools-log-monitor",
3333
"devDependencies": {
34-
"babel": "^5.5.8",
35-
"babel-core": "^5.6.18",
36-
"babel-eslint": "^3.1.15",
37-
"babel-loader": "^5.1.4",
34+
"babel-cli": "^6.1.2",
35+
"babel-core": "^6.1.2",
36+
"babel-eslint": "^4.1.4",
37+
"babel-loader": "^6.0.1",
38+
"babel-plugin-transform-react-jsx": "^6.0.18",
39+
"babel-preset-es2015": "^6.1.2",
40+
"babel-preset-stage-0": "^6.1.2",
3841
"eslint": "^0.23",
3942
"eslint-config-airbnb": "0.0.6",
4043
"eslint-plugin-react": "^2.3.0",

Diff for: src/LogMonitor.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const styles = {
3939
}
4040
};
4141

42-
export default class LogMonitor extends Component {
42+
class LogMonitor extends Component {
4343
static reducer = reducer;
4444

4545
static propTypes = {
@@ -234,3 +234,5 @@ export default class LogMonitor extends Component {
234234
);
235235
}
236236
}
237+
238+
export default LogMonitor;

Diff for: src/LogMonitorButton.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const styles = {
2020
}
2121
};
2222

23-
export default class LogMonitorButton extends React.Component {
23+
class LogMonitorButton extends React.Component {
2424
shouldComponentUpdate = shouldPureComponentUpdate;
2525

2626
constructor(props) {
@@ -94,3 +94,5 @@ export default class LogMonitorButton extends React.Component {
9494
);
9595
}
9696
}
97+
98+
export default LogMonitorButton;

Diff for: src/LogMonitorEntry.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const styles = {
1313
}
1414
};
1515

16-
export default class LogMonitorEntry extends Component {
16+
class LogMonitorEntry extends Component {
1717
static propTypes = {
1818
state: PropTypes.object.isRequired,
1919
action: PropTypes.object.isRequired,
@@ -95,3 +95,5 @@ export default class LogMonitorEntry extends Component {
9595
);
9696
}
9797
}
98+
99+
export default LogMonitorEntry;

Diff for: src/LogMonitorEntryAction.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const styles = {
1313
}
1414
};
1515

16-
export default class LogMonitorAction extends React.Component {
16+
class LogMonitorAction extends React.Component {
1717
renderPayload(payload) {
1818
return (
1919
<div style={{
@@ -42,3 +42,5 @@ export default class LogMonitorAction extends React.Component {
4242
);
4343
}
4444
}
45+
46+
export default LogMonitorAction;

0 commit comments

Comments
 (0)