-
Notifications
You must be signed in to change notification settings - Fork 6
isomorphic-relay-router integration? #11
Comments
We're working on the same problem in an internal project. HMR is broken, but our client index looks something like this:
We'll update you when we fix HMR. There's also talk about starting a Relay kyt. |
Thank you so much! (note: I am complete relay noob, and more or less noob in general)
babelLoader.query.presets.env.development.plugins.push('react-hmre');
IsomorphicRouter
.prepareData(renderProps, networkLayer)
.then(({ data, props }) => {
// When a React Router route is matched then we render
// the components and assets into the template.
res.status(200).send(template({
root: renderToString(IsomorphicRouter.render(props)),
jsBundle: clientAssets.main.js,
cssBundle: clientAssets.main.css,
preloadedData: data
}));
}).catch(next); (dunno if this is entirely correct) const mount = () => {
match({ routes, history: browserHistory }, (error, redirectLocation, renderProps) => {
if (error) throw error;
IsomorphicRouter.prepareInitialRender(environment, renderProps).then((props) => { // eslint-disable-line max-len
ReactDOM.render(
<AppContainer>
<Router render={applyRouterMiddleware(IsomorphicRouter.useIsoRelay)} {...props} />
</AppContainer>,
root
);
});
});
}; It almost works: It reloads properly on the first change, throws |
I think you can ignore those warnings. You can check out this issue here for more. The solution calls for wrapping a Root component in an |
Relay isomorphic kyt would be awesome. I feel more and more lost while trying to implement Relay integration. I finally managed to do it for one page, but that page got horribly broken: when I click on it's link it throws bunch of errors:
And page navigation is cancelled. Not sure if it's me or something else is broken |
I consider this issue solved. Using the example code from here and hot reloading seems to work |
I have trouble integrating isomorphic-relay-router. Following the example on their page, I have this in my client/index.js:
It kinda works, but it gives me ERR_CONNECTION_REFUSED every time I edit some component. Is there something wrong with my code, or I can't use this that way?
The text was updated successfully, but these errors were encountered: