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

The UI actions of DevTools monitor cannot be apply main process store #6

Closed
jhen0409 opened this issue Dec 25, 2015 · 1 comment
Closed

Comments

@jhen0409
Copy link

Renderer

let finalCreateStore = compose(
  applyMiddleware(...middleware),
  electronEnhancer({filter}),
  DevTools.instrument()
)(createStore);

It seems obvious, the UI actions of LogMonitor cannot be apply to main process store, any plans to solve this problem?

@samiskin
Copy link
Owner

Something along the lines of this is what I did:

let storeEnhancers = compose(
 ...
  applyMiddleware(thunk, logger)
);

if (process.type === 'renderer' && !process.guestInstanceId) {
  let DevTools = require('DevTools');
  storeEnhancers = compose(
    storeEnhancers,
    require('DevTools').instrument()
  );
}

let store = storeEnhancers(createStore)(reducer);

process.type === 'renderer' ensures that I'm not in the browser process, and !process.guestInstanceId ensures I'm not in a webView.

What I actually did in our production code was I separated BrowserStore and RendererStore and exported one based on what process I was in (since there were some other custom details).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants