zalmoxisus / remote-redux-devtools

Redux DevTools remotely.
http://zalmoxisus.github.io/monitoring/
MIT License
1.8k stars 138 forks source link

with composeWithDevTools, couldn't use 'dispatch' in the action creator. #70

Closed royjkim closed 7 years ago

royjkim commented 7 years ago

I want to know the reason why 'remote-redux-devtools' can't work with 'redux-thunk'.


  1. not working, 'remote-redux-devtools' with 'redux-thunk'

1-1. When I use 'remote-redux-devtools' with 'redux-thunk', I can't use 'dispatch'. const composeEnhancers = composeWithDevTools({ realtime: true }) const store = createStore(reducer, composeEnhancers( applyMiddleware(thunk) ))

error1

1-2. When I use 'remote-redux-devtools' like below, it looks like 'compose()' doesn't work. const store = createStore(reducer, composeWithDevTools( applyMiddleware(thunk) ))

error2
  1. When I use 'redux-logger' instead of 'remote-redux-devtools', it works fine. const logger = createLogger() const store = createStore(reducer, compose( applyMiddleware( thunk, logger ) ))

  2. package "react": "15.4.2", "react-native": "0.40.0", "react-redux": "^5.0.3", "redux": "^3.6.0", "redux-logger": "^2.8.2", "redux-thunk": "^2.2.0"

"remote-redux-devtools": "^0.5.7"

zalmoxisus commented 7 years ago

It works, you can check it with our counter example. It applies redux-thunk middleware and dispatch works.

The problem could be that you're importing composeWithDevTools not as:

import { composeWithDevTools } from 'remote-redux-devtools';

but

import composeWithDevTools from 'remote-redux-devtools';

So, you're getting the store enhancer instead.

royjkim commented 7 years ago

@zalmoxisus Thanks to your quick answer. I already understood what you want to tell me.

Anyway, like I said I just want to know the exact reason. (because 'remote-redux-devtools' is cool !). I'll try more things on another projects.

lukebarton commented 6 years ago

Also having this issue but only without { realtime: true } With {realtime: true} I get SocketProtocolError: Socket hung up

I had it working with the basic enhancer but it would only work 1 out of 3 requests. I guess there's a race condition or something.