Skip to content
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

Allow to get action result #32

Closed
wants to merge 1 commit into from
Closed

Conversation

vslinko
Copy link
Contributor

@vslinko vslinko commented Jun 4, 2015

I want to wait for an async action before React.renterToString on server. Example

function fetchDataForHomePageActionCreator() {
  return async dispatch => {
    await timeout(100)
    dispatch({type: HOMEPAGE_DATA_LOADED})
  }
}

async function homepageHandler(request) {
  const dispatcher = createDispatcher()
  const prepare = dispatcher.wrapActionCreator(fetchDataForHomePageActionCreator)
  await prepare()
  return React.renderToString(<Dispatcher dispatcher={dispatcher}><HomePage /></Dispatcher>)
}

I want to wait for an async action before React.renterToString on server. Example
```
function fetchDataForHomePageActionCreator() {
  return async dispatch => {
    await timeout(100)
    dispatch({type: HOMEPAGE_DATA_LOADED})
  }
}

async function homepageHandler(request) {
  const dispatcher = createDispatcher()
  const prepare = dispatcher.wrapActionCreator(fetchDataForHomePageActionCreator)
  await prepare()
  return React.renderToString(<Dispatcher dispatcher={dispatcher}><HomePage /></Dispatcher>)
}
```
vslinko added a commit to vslinko/redux that referenced this pull request Jun 4, 2015
@gaearon
Copy link
Contributor

gaearon commented Jun 4, 2015

Thanks for the PRs, please let me take some time before considering this.
I'm going to change some internal parts pretty heavy with #6 so I want to let this hang for a while.

@vslinko
Copy link
Contributor Author

vslinko commented Jun 4, 2015

No problem, I'm just playing with.
I'm trying to implement isomorphic app using redux and I'm sure that I'll want to use redux in production anytime soon.

@gaearon
Copy link
Contributor

gaearon commented Jun 6, 2015

Closed via #46

(If this is still relevant pls reopen)

@gaearon gaearon closed this Jun 6, 2015
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