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
Isomorphic application #13
Comments
This is basically what https://github.com/yahoo/fluxible does, I used it in Morpheus and it worked very well. Maybe you can take inspiration from there, it would be great to see Marty as a full fledged flux solution, managing context and server-side rendering. |
+1, isomorphic feature for me is probably the most important reason I switched from AngularJS. |
Yup! If you have a look at https://github.com/jhollingworth/marty-express we consume implement a node.js middleware which consumes react-router routes and automatically renders them if you request the URL. It also will intercept http requests in the http state source, fully qualifies the URL and forwards headers from the original request. If all goes well a browser version will work on the server with a couple of small changes
|
Lol...yeah...I found it just after posting the comment 😊 |
This is preventing us from adopting marty for a new project. We are using fluxxor at the moment which while excellent does involve a lot of boilerplate around async data fetching. Have some time before we need to commit though! |
It's on the way, I'm hoping the isomorphic stuff will be in beta by the end of next week |
In v0.9 branch |
So that I can have better SEO and initial render time I want to be able to render the representation of the application on the server. i.e. isomorphism.
Concurrency issues
One of the biggest problems right now is that everything in Marty is a singleton. However you could also think of
createStore
,createActionCreators
, etc as registration functions. If we have an internal registry of all types, action creators, etc we could then create new instances of them. The interface you return fromcreateStore
would just be a proxy to whatever instance of the store you specify(De)Hydration
Stores have the
getInitialState()
function which is where you get the initial state of the store and, if required, make any HTTP calls to hydrate the store.I propose we allow you to specify the initial state on the server which, when the store is loaded, is passed to the stores getInitialState
This way you can do any transformations (e.g. turning the object into a immutable object).
Marty.renderToString(component, instance)
would a string that should be injected into the page that would include the html as well as the initial dehydrated state.The text was updated successfully, but these errors were encountered: