redux-async-connect
redux-async-connect copied to clipboard
rc3 -> rc4 breaks server side rendering
I am using the erikras/react-redux-universal-hot-example boilerplate, which depends on this library.
When upgrading from rc3 to rc4, server side rendering breaks completely. Here is the implementation of redux-async-connect on the server:
loadOnServer({...renderProps, store, helpers: {client}}).then(() => {
const component = (
<Provider store={store} key="provider">
<ReduxAsyncConnect {...renderProps} />
</Provider>
);
res.status(200);
global.navigator = {userAgent: req.headers['user-agent']};
res.send('<!doctype html>\n' +
ReactDOM.renderToString(<Html assets={webpackIsomorphicTools.assets()} component={component} store={store}/>));
});
I don't get any errors, but none of the components are output in the renderToString.
Did something change about the loadOnServer API that needs to be adjusted in the code above?
+1 on this. I'm having major issues loading components at different levels. For example, a Parent component loading one item through asynconnect, while it's Child component loads something else through asynconnect does not work at all.
Related issue #61
The rc4 commit: https://github.com/Rezonans/redux-async-connect/commit/9af423c70b446ed63b9431c7d31770bebbf5f693
I commented below the commit....I believe it's missing 'return ' in front of args.store.dispatch(endGlobalLoad());
Never mind...it's not meant to be chainable I think
@Morriz find us the real fix man!
I have been debugging this issue all day, but couldn't get it to work. It's becoming too complex with all the parts outsmarting each other.
Well, fwiw, I have got server rendering working fine now with rc4 (and rc3 and 2), but find that the client renders a noscript. Probably because react-router is not coupled correctly and rendering is triggered too soon
Related PR: https://github.com/Rezonans/redux-async-connect/pull/70
Why have a rc4 if the fix is the revert to rc3? Am I missing something?
@Morriz How did you get it working?
try using https://github.com/makeomatic/redux-connect - its a fork with improvements