{"action":"opened","issue":{"url":"https://api.github.com/repos/erikras/redux-form/issues/1068","repository_url":"https://api.github.com/repos/erikras/redux-form","labels_url":"https://api.github.com/repos/erikras/redux-form/issues/1068/labels{/name}","comments_url":"https://api.github.com/repos/erikras/redux-form/issues/1068/comments","events_url":"https://api.github.com/repos/erikras/redux-form/issues/1068/events","html_url":"https://github.com/erikras/redux-form/issues/1068","id":157352381,"number":1068,"title":"[Question] initialize form in reducer in reaction to async action","user":{"login":"johanneslumpe","id":3470207,"avatar_url":"https://avatars.githubusercontent.com/u/3470207?v=3","gravatar_id":"","url":"https://api.github.com/users/johanneslumpe","html_url":"https://github.com/johanneslumpe","followers_url":"https://api.github.com/users/johanneslumpe/followers","following_url":"https://api.github.com/users/johanneslumpe/following{/other_user}","gists_url":"https://api.github.com/users/johanneslumpe/gists{/gist_id}","starred_url":"https://api.github.com/users/johanneslumpe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johanneslumpe/subscriptions","organizations_url":"https://api.github.com/users/johanneslumpe/orgs","repos_url":"https://api.github.com/users/johanneslumpe/repos","events_url":"https://api.github.com/users/johanneslumpe/events{/privacy}","received_events_url":"https://api.github.com/users/johanneslumpe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-28T18:56:32Z","updated_at":"2016-05-28T18:56:32Z","closed_at":null,"body":"In a project I'm working on I have the requirement that users need to be redirected to a different part of the form if certain fields aren't filled out. The data for those fields comes from an async request. In my redirect check I'm checking whether we are currently loading data, in order to prevent a premature redirect. The issue is that when the dispatched promise resolves and I initialize the form with the `initialize` action creator in a `then`, the component will already have re-rendered and initiated the redirect. So instead of dispatching a separate init action I figured it would be easier/better/less error prone to initialize the form from within the reducer in reaction to a successful async action.\r\n\r\n@erikras Would this be the right way to do it? I saw that `initializeState` isn't exported so I don't really want to use it unless you think that's the right way to go. I'm open to other solutions though. Any feedback would be greatly appreciated.\r\n\r\nUsing v5."}}
{"actor":{"display_login":"johanneslumpe"}}