{"action":"created","issue":{"url":"https://api.github.com/repos/react-tools/react-form/issues/58","repository_url":"https://api.github.com/repos/react-tools/react-form","labels_url":"https://api.github.com/repos/react-tools/react-form/issues/58/labels{/name}","comments_url":"https://api.github.com/repos/react-tools/react-form/issues/58/comments","events_url":"https://api.github.com/repos/react-tools/react-form/issues/58/events","html_url":"https://github.com/react-tools/react-form/issues/58","id":223095901,"number":58,"title":"Form Api - `addValue` not working as expected","user":{"login":"AverageZ","id":9088088,"avatar_url":"https://avatars3.githubusercontent.com/u/9088088?v=4","gravatar_id":"","url":"https://api.github.com/users/AverageZ","html_url":"https://github.com/AverageZ","followers_url":"https://api.github.com/users/AverageZ/followers","following_url":"https://api.github.com/users/AverageZ/following{/other_user}","gists_url":"https://api.github.com/users/AverageZ/gists{/gist_id}","starred_url":"https://api.github.com/users/AverageZ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AverageZ/subscriptions","organizations_url":"https://api.github.com/users/AverageZ/orgs","repos_url":"https://api.github.com/users/AverageZ/repos","events_url":"https://api.github.com/users/AverageZ/events{/privacy}","received_events_url":"https://api.github.com/users/AverageZ/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-04-20T14:55:51Z","updated_at":"2017-10-31T03:22:32Z","closed_at":"2017-10-31T03:22:32Z","author_association":"CONTRIBUTOR","body":"Version: `\"react-form\": \"^1.2.6\"`\r\n\r\n### Overview\r\n\r\nI've been referencing the annotated example as I build a form that contains a nested form. The nested form is a list of items called `phonenumbers` (like 'friends' in the example). Outside of the nested form is an element that uses the `addValue` method from the library. The goal is to use the add button to add a new item to the list which will then get rendered etc.\r\n\r\n### The issue\r\nWhen I click the `addValue` button, it resets the value of `phonenumbers` instead of pushing or appending the `newBasePhone` object\r\n\r\n-----\r\n\r\nIn the following example:\r\n\r\n* `phonenumbers` is a list of objects with keys like: \"value\", \"label\", \"type\"\r\n* `newBasePhone` is an object like the ones in `phonenumbers` and has a \"label\" of \"new\"\r\n\r\nThe main form referencing the nested form and the Add button\r\n```jsx\r\n<NestedForm\r\n  field=\"phonenumbers\"\r\n>\r\n  {SmartPhoneInput}\r\n</NestedForm>\r\n\r\n<ActionsWrapper>\r\n  <Button\r\n    type=\"primary\"\r\n    onClick={() => addValue('phonenumbers', newBasePhone)}\r\n  >\r\n    Add Number\r\n  </Button>\r\n</ActionsWrapper>\r\n```\r\n\r\nThe `SmartPhoneInput` nested form spitting out just the label for now.\r\n```jsx\r\nconst SmartPhoneInput = (\r\n  <Form>\r\n    {({ values }) => (\r\n      <Wrapper>\r\n        {\r\n          map(values, (number, index) => (\r\n            <p>{number.label}</p>\r\n          ))\r\n        }\r\n      </Wrapper>\r\n    )}\r\n  </Form>\r\n);\r\n```\r\n\r\n![apr-20-2017 10-53-27](https://cloud.githubusercontent.com/assets/9088088/25237072/a44f1a72-25b7-11e7-9765-790b6f1fd636.gif)\r\n"},"comment":{"url":"https://api.github.com/repos/react-tools/react-form/issues/comments/340648835","html_url":"https://github.com/react-tools/react-form/issues/58#issuecomment-340648835","issue_url":"https://api.github.com/repos/react-tools/react-form/issues/58","id":340648835,"user":{"login":"tannerlinsley","id":5580297,"avatar_url":"https://avatars0.githubusercontent.com/u/5580297?v=4","gravatar_id":"","url":"https://api.github.com/users/tannerlinsley","html_url":"https://github.com/tannerlinsley","followers_url":"https://api.github.com/users/tannerlinsley/followers","following_url":"https://api.github.com/users/tannerlinsley/following{/other_user}","gists_url":"https://api.github.com/users/tannerlinsley/gists{/gist_id}","starred_url":"https://api.github.com/users/tannerlinsley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tannerlinsley/subscriptions","organizations_url":"https://api.github.com/users/tannerlinsley/orgs","repos_url":"https://api.github.com/users/tannerlinsley/repos","events_url":"https://api.github.com/users/tannerlinsley/events{/privacy}","received_events_url":"https://api.github.com/users/tannerlinsley/received_events","type":"User","site_admin":false},"created_at":"2017-10-31T03:22:32Z","updated_at":"2017-10-31T03:22:32Z","author_association":"COLLABORATOR","body":"This is now working as expected. Closing for now."}}
{"actor":{"display_login":"tannerlinsley"}}