brocoders / redux-async-connect

It allows you to request async data, store them in redux state and connect them to your react component.
645 stars 103 forks source link

Middleware exceptions in RC4 get sunk #71

Open djeeg opened 8 years ago

djeeg commented 8 years ago

I have a store setup like this

const store = createStore(
    rootReducer,
    initialState,
    compose(
        applyMiddleware(
            routerMiddleware(history),
            <any>thunkMiddleware,
            simpleLoggerMiddleware
        )
    )
)

And a custom logging middleware (not the safest code, but good for this example)

const simpleLoggerMiddleware = store => next => action => {
    console.log('payload', action.payload)
    console.log('payload:type', action.payload.constructor.name)
}

If I run this with RC3, I get a nice error dump in Node console

reduxAsyncConnect/END_GLOBAL_LOAD
payload undefined
TypeError: Cannot read property 'constructor' of undefined
    at \webapp\code\common\redux\configureStore.ts:111:55
    at \webapp\node_modules\redux-thunk\lib\index.js:9:74
    at Object.dispatch (\webapp\node_modules\react-router-redux\lib\middleware.js:22:18)
    at \webapp\node_modules\redux-async-connect\lib\ReduxAsyncConnect.js:143:16
    at process._tickCallback (node.js:401:9)

However with RC4, I get no error message in Node console, and the end result is the server rendering is not output

Is there a way to still bubble random exceptions when server rendering?

hanjukim commented 8 years ago

Related PR: https://github.com/Rezonans/redux-async-connect/pull/70