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
Scrap Marty.Component in favour of Marty.createContainer #206
Conversation
👍 came here to suggest just that and spotted this PR. Totally on for dropping EDIT: Missed that ES feature :/, don't mind the example question. It might also be a good idea to keep |
We have some container components (view-controllers) in Marty v0.8 where some of the fetches depend on the results other ones. I like the convenience of this proposed API, but it doesn't allow for fetches to depend on others or for possibly more complicated behavior. How about only putting your implementation of getState on the container (which puts each fetch on the state) if there's not already a getState function defined on the config object? Then I can continue to use an implementation for getState like I already do for the v0.8 StateMixins for these situations. |
@dariocravero awesome, glad you like it 😄 I'd like to keep the |
@pbomb How about if I allowed fetch to either be a function or an object literal? module.exports = Marty.createContainer(User, {
fetch() {
return {
user: UserStore.getUser(this.props.id),
friends: FriendsStore.getFriends(this.props.id)
}
}
}); |
Yeah, I thought about that too. I like it! On Sun, Mar 22, 2015, 9:53 AM James Hollingworth notifications@github.com
|
Conflicts: dist/node/lib/context.js dist/node/lib/create.js dist/node/lib/storeObserver.js dist/node/lib/utils/resolve.js lib/context.js lib/create.js
cool, implemented in 4ce9143 |
Scrap Marty.Component in favour of Marty.createContainer
Class ;) |
It would be great to be able to specify the display name is the container component, either by padding or in our by adding 'Container' to the display name of the inner component. We like to record metrics and these names are helpful. |
@pbomb would "{InnerComponentDisplayName}Container" be fine? e.g. <FooContainer>
<Foo />
</FooContainer> |
I think so On Mon, Mar 23, 2015, 6:16 AM James Hollingworth notifications@github.com
|
FB just blogged about how Relay works. This makes a lot of sense and gets around a load of the issues with
Marty.Component
(e.g.contextTypes
, having to inherit from a base class). This PR gets rid ofMarty.Component
and replicates theRelay.createContainer
API.To do
Marty.createContainer
Marty.Component
Marty.Component
Resolves #204