Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to Redux DevTools 3.0 Beta 2 #369

Merged
merged 1 commit into from
Oct 17, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
"react-document-meta": "2.0.0-rc2",
"react-dom": "0.14.0",
"react-inline-css": "2.0.0",
"react-redux": "3.1.0",
"react-redux": "^4.0.0",
"react-router": "1.0.0-rc3",
"redux": "3.0.1",
"redux-form": "^2.2.6",
Expand Down Expand Up @@ -153,7 +153,9 @@
"react-transform-catch-errors": "^1.0.0",
"react-transform-hmr": "^1.0.1",
"redbox-react": "^1.1.1",
"redux-devtools": "^2.1.5",
"redux-devtools": "^3.0.0-beta-2",
"redux-devtools-dock-monitor": "^1.0.0-beta-2",
"redux-devtools-log-monitor": "^1.0.0-beta-2",
"redux-router": "1.0.0-beta3",
"sass-loader": "^3.0.0",
"strip-loader": "^0.1.0",
Expand Down
28 changes: 17 additions & 11 deletions src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,15 @@ function initSocket() {
global.socket = initSocket();

const component = (
<Provider store={store} key="provider">
<ReduxRouter routes={getRoutes(store)} />
</Provider>
<ReduxRouter routes={getRoutes(store)} />
);

ReactDOM.render(component, dest);
ReactDOM.render(
<Provider store={store} key="provider">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious: why the key here?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea. No good reason, probably. Must've been part of an array of components at some point.

{component}
</Provider>,
dest
);

if (process.env.NODE_ENV !== 'production') {
window.React = React; // enable debugger
Expand All @@ -51,11 +54,14 @@ if (process.env.NODE_ENV !== 'production') {
}

if (__DEVTOOLS__) {
const { DevTools, DebugPanel, LogMonitor } = require('redux-devtools/lib/react');
ReactDOM.render(<div>
{component}
<DebugPanel top right bottom key="debugPanel">
<DevTools store={store} monitor={LogMonitor}/>
</DebugPanel>
</div>, dest);
const DevTools = require('./containers/DevTools/DevTools');
ReactDOM.render(
<Provider store={store} key="provider">
<div>
{component}
<DevTools />
</div>
</Provider>,
dest
);
}
11 changes: 11 additions & 0 deletions src/containers/DevTools/DevTools.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';
import { createDevTools } from 'redux-devtools';
import LogMonitor from 'redux-devtools-log-monitor';
import DockMonitor from 'redux-devtools-dock-monitor';

export default createDevTools(
<DockMonitor toggleVisibilityKey="H"
changePositionKey="Q">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try Ctrl+Q :-)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not to be confused with Cmd-Q. 😄

<LogMonitor />
</DockMonitor>
);
5 changes: 3 additions & 2 deletions src/redux/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ export default function createStore(reduxReactRouter, getRoutes, createHistory,

let finalCreateStore;
if (__DEVELOPMENT__ && __CLIENT__ && __DEVTOOLS__) {
const { devTools, persistState } = require('redux-devtools');
const { persistState } = require('redux-devtools');
const DevTools = require('../containers/DevTools/DevTools');
finalCreateStore = compose(
applyMiddleware(...middleware),
devTools(),
DevTools.instrument(),
persistState(window.location.href.match(/[?&]debug_session=([^&]+)\b/))
)(_createStore);
} else {
Expand Down