jcoreio / crater

Meteor/Webpack/React SSR app skeleton that runs your app code outside of Meteor Isobuild
ISC License
82 stars 10 forks source link

Redux-thunk doesn't work in production (SSR) #75

Closed darkadept closed 7 years ago

darkadept commented 7 years ago

It doesn't work to dispatch thunk actions in production SSR. The following error occurs:

Error: Actions must be plain objects. Use custom middleware for async actions..

From what I can tell it's because the makeStore.js is never called in production SSR (createSSR.js). The store is created with: const store = createStore(makeReducer(), iMap()) Middlewares are not applied during SSR.

jedwards1211 commented 7 years ago

Good point, we could use makeStore on both server and client side and wrap application of client-specific middlewares in if (Meteor.isClient) blocks.