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

redux-thunk instead of actions #25

Open
goodmind opened this issue Nov 11, 2017 · 5 comments
Open

redux-thunk instead of actions #25

goodmind opened this issue Nov 11, 2017 · 5 comments

Comments

@goodmind
Copy link

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

@joshburgess
Copy link
Owner

joshburgess commented Nov 16, 2017

@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.

@goodmind
Copy link
Author

goodmind commented Nov 20, 2017

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

@joshburgess
Copy link
Owner

@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.

@goodmind
Copy link
Author

@joshburgess btw it's just transition phase from thunks

@joshburgess
Copy link
Owner

@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.

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

No branches or pull requests

2 participants