{"action":"created","issue":{"url":"https://api.github.com/repos/erikras/redux-form/issues/2838","repository_url":"https://api.github.com/repos/erikras/redux-form","labels_url":"https://api.github.com/repos/erikras/redux-form/issues/2838/labels{/name}","comments_url":"https://api.github.com/repos/erikras/redux-form/issues/2838/comments","events_url":"https://api.github.com/repos/erikras/redux-form/issues/2838/events","html_url":"https://github.com/erikras/redux-form/issues/2838","id":223223422,"number":2838,"title":"Field validation not triggered after reset","user":{"login":"bbenezech","id":26794,"avatar_url":"https://avatars2.githubusercontent.com/u/26794?v=3","gravatar_id":"","url":"https://api.github.com/users/bbenezech","html_url":"https://github.com/bbenezech","followers_url":"https://api.github.com/users/bbenezech/followers","following_url":"https://api.github.com/users/bbenezech/following{/other_user}","gists_url":"https://api.github.com/users/bbenezech/gists{/gist_id}","starred_url":"https://api.github.com/users/bbenezech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbenezech/subscriptions","organizations_url":"https://api.github.com/users/bbenezech/orgs","repos_url":"https://api.github.com/users/bbenezech/repos","events_url":"https://api.github.com/users/bbenezech/events{/privacy}","received_events_url":"https://api.github.com/users/bbenezech/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-04-20T22:47:51Z","updated_at":"2017-04-24T21:11:33Z","closed_at":null,"body":"Very easy to reproduce:\r\n\r\nhttps://codesandbox.io/s/o22j1lOZB\r\n\r\nModify age, then reset, then modify age, then submit.\r\nField validation on `Username` and `Email` are bypassed.\r\n`UPDATE_SYNC_ERRORS` is not triggered after reset like it is when a validated field is dirty.\r\n\r\nIt looks like the conditions `updateSyncErrorsIfNeeded` are incorrects.\r\n\r\nThis is a major issue IMO. I have no easy workaround. \r\n@erikras I know you must be terribly busy but can you have a look?"},"comment":{"url":"https://api.github.com/repos/erikras/redux-form/issues/comments/296823577","html_url":"https://github.com/erikras/redux-form/issues/2838#issuecomment-296823577","issue_url":"https://api.github.com/repos/erikras/redux-form/issues/2838","id":296823577,"user":{"login":"timhwang21","id":5831434,"avatar_url":"https://avatars0.githubusercontent.com/u/5831434?v=3","gravatar_id":"","url":"https://api.github.com/users/timhwang21","html_url":"https://github.com/timhwang21","followers_url":"https://api.github.com/users/timhwang21/followers","following_url":"https://api.github.com/users/timhwang21/following{/other_user}","gists_url":"https://api.github.com/users/timhwang21/gists{/gist_id}","starred_url":"https://api.github.com/users/timhwang21/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timhwang21/subscriptions","organizations_url":"https://api.github.com/users/timhwang21/orgs","repos_url":"https://api.github.com/users/timhwang21/repos","events_url":"https://api.github.com/users/timhwang21/events{/privacy}","received_events_url":"https://api.github.com/users/timhwang21/received_events","type":"User","site_admin":false},"created_at":"2017-04-24T21:11:33Z","updated_at":"2017-04-24T21:11:33Z","body":"I actually ran into this exact issue myself a while back. Really appreciate the PR, and I'm willing to help get this moved along!\r\n\r\nYou probably want to add a test [here](https://github.com/erikras/redux-form/blob/master/src/__tests__/reducer.reset.spec.js). Specifically, something like `it should not erase sync errors if they exist.` The test structure is pretty self-explanatory.\r\n\r\nOne question I have: I'm wondering about the order of things happening. \r\n\r\n1. [Validation seems to happen when new props are received](https://github.com/erikras/redux-form/blob/809c8414121ba2c3de1a5797d259ac4ebb56193e/src/reduxForm.js#L244). This function checks to see if values are deeply equal, and skips validation if so.\r\n2. Your PR seems to be simultaneously setting the `values` to `initialValues`, and `syncErrors` to the existing `syncErrors`. Wouldn't these errors be outdated, so to speak?\r\n3. The issue is only happening when \"Age\" is the only field populated when the form is reset. In other words, validation is being run after resetting when \"Name\" or \"Email\" field values change upon reset. It's not that errors aren't being properly persisted.\r\n\r\nIt seems the correct fix would lie in making either `updateSyncErrorsIfNeeded` or `validateIfNeeded` in the main file more robust."}}
{"actor":{"display_login":"timhwang21"}}