redux-most icon indicating copy to clipboard operation
redux-most copied to clipboard

redux-thunk instead of actions

Open goodmind opened this issue 6 years ago • 5 comments

If used with redux-thunk I got functions in stream instead of dispatched actions. Used same way as in docs with createStateStreamEnhancer

goodmind avatar Nov 11 '17 20:11 goodmind

@goodmind Can you copy and paste your store setup code here for me to look at? After that, I'll try to replicate it and figure out what's going on.

joshburgess avatar Nov 16 '17 17:11 joshburgess

const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose
const middlewares = [
   thunk,
]
const storeEnhancers = composeEnhancers(
  createStateStreamEnhancer(epicMiddleware),
  applyMiddleware(...middlewares)
)
const store = createStore(
  combineReducers(reducers),
  storeEnhancers,
)

goodmind avatar Nov 20 '17 08:11 goodmind

@goodmind Alright, I'm pretty sure I know what the problem is. I'll try to work out a fix soon.

Sorry, I never really intended it to be used in tandem with redux-thunk, but I should be able to make it work.

joshburgess avatar Nov 21 '17 16:11 joshburgess

@joshburgess btw it's just transition phase from thunks

goodmind avatar Nov 21 '17 18:11 goodmind

@goodmind Sorry for the long wait. I'm looking into this again now, but still in the process of figuring out how to accomplish it. It involves changing the definition of createStateStreamEnhancer to accept multiple middleware (just like applyMiddleware works..... applyMiddleware is really just an enhancer like anything else), but I'm running into some issues which I believe are due to both epics and thunks being of type function, but I'm still trying to figure it out.

I'll have progress on it in a new branch called redux-thunk-compatibility if you'd like to take a look and help out.

joshburgess avatar Feb 17 '18 21:02 joshburgess