-
Notifications
You must be signed in to change notification settings - Fork 102
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
Proof of concept of deferred props #24
base: master
Are you sure you want to change the base?
Conversation
@sergesemashko Thank you, for this PR, To be honest, i don't really like this approach - I mean new static method and so on... |
Thanks for the feedback, @sars. I understand. But I would like to know if there are more specific concerns about static methods, etc. or your vision how it would be better to implement this feature. |
Hey, any news when async props can be available here? |
@krzysztofpniak I'm working on v1.0.0 |
@sergesemashko, @krzysztofpniak , take a look please: there is new interface for @asyncConnect decorator in this version. Now you can use it like: @asyncConnect([
{key: 'lunch', promise: ({params, helpers}) => helpers.client.get('/lunches/' + params.lunchId), group: 'smth'}
]) and then in your client.js: const component = (
<Router render={(props) =>
<ReduxAsyncConnect {...props} filter={item => item.group === 'smth'} helpers={{client}} />
} history={browserHistory}>
{getRoutes(store, client)}
</Router>
); and server.js: loadOnServer({...renderProps, store, helpers: {client}}).then(() => {
// ...
} Does it works for you? |
hey @sars, sorry for the delay. I assume there should an additional filter for server: loadOnServer({...renderProps, store, helpers: {client}}).then(() => {
const appHTML = renderToString(
<Provider store={store} key="provider">
<ReduxAsyncConnect filter={item => item.group !== 'deferred'} {...renderProps} />
</Provider>
)
} Right? From the first look, this way of defining deferred props not too obvious and requires patching of the application with filter. It would make sense to make it more explicitly, I think. Overall, it should work. Just curious, what are the other purposes of filters aside deferred props? Thanks |
@sars is the purpose of the array suppose to be sequential? |
@mmahalwy |
This a proof of concept for having deferred props.
Usage
Pass deferred props as a 2nd parameter to
@asyncConnect
:Under the hood
{loading: false, loaded: false}
componentDidMount
TODO:
@sars, let me know what do you think