Skip to content

Conversation

@evenchange4
Copy link

Try to solve the PR at #872

@sars
Copy link
Member

sars commented Feb 1, 2016

@evenchange4 , to be honest, i didn't catch what this PR solves.
this code is never called on server side...

@evenchange4
Copy link
Author

It solves the same thing what #872 does, but checking __SERVER__ inside the redux-async-connect.
I mean the server side render.

cc @sars

@sars
Copy link
Member

sars commented Feb 12, 2016

@evenchange4, take a look please:
https://github.com/Rezonans/redux-async-connect/tree/v1

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?

@evenchange4
Copy link
Author

okay works for me
@sars thanks!
close it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants