{"action":"created","issue":{"url":"https://api.github.com/repos/moroshko/react-autosuggest/issues/28","labels_url":"https://api.github.com/repos/moroshko/react-autosuggest/issues/28/labels{/name}","comments_url":"https://api.github.com/repos/moroshko/react-autosuggest/issues/28/comments","events_url":"https://api.github.com/repos/moroshko/react-autosuggest/issues/28/events","html_url":"https://github.com/moroshko/react-autosuggest/issues/28","id":85517726,"number":28,"title":"State handling","user":{"login":"Halama","id":903531,"avatar_url":"https://avatars.githubusercontent.com/u/903531?v=3","gravatar_id":"","url":"https://api.github.com/users/Halama","html_url":"https://github.com/Halama","followers_url":"https://api.github.com/users/Halama/followers","following_url":"https://api.github.com/users/Halama/following{/other_user}","gists_url":"https://api.github.com/users/Halama/gists{/gist_id}","starred_url":"https://api.github.com/users/Halama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Halama/subscriptions","organizations_url":"https://api.github.com/users/Halama/orgs","repos_url":"https://api.github.com/users/Halama/repos","events_url":"https://api.github.com/users/Halama/events{/privacy}","received_events_url":"https://api.github.com/users/Halama/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/moroshko/react-autosuggest/labels/inputAttributes","name":"inputAttributes","color":"fad8c7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-06-05T12:13:41Z","updated_at":"2015-06-10T16:47:57Z","closed_at":null,"body":"Hi,\r\nwe have encountered issue with component state. The component hold current value of input in it's internal state, so when the property `inputAttributes.value` is changed the change is ignored by Autosuggest component.\r\n\r\nHere is the demo https://jsfiddle.net/1y4v9pw6/3/ \r\n\r\nThe fix is remove state from component https://github.com/keboola/react-autosuggest/commit/d13008c27e2148205855b0a2fea70dfdc03eaeef and let it behave as controlled component https://facebook.github.io/react/docs/forms.html#controlled-components\r\n\r\nHere is the demo same demo but with patched Autosuggest https://jsfiddle.net/2cuf1mzu/1/\r\n\r\nThis fix BC break, maybe also component which only holds the state could be provided for BC compatiblity.\r\n\r\nOur use case where we discovered this issue is form where the initial value of Autosuggest component is dependent on some select value which is used before autosuggest.\r\n\r\nAlso passing a value instead of event to handler `inputAttributes.onChange` is bit strange.\r\nthanks.\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/moroshko/react-autosuggest/issues/comments/110829653","html_url":"https://github.com/moroshko/react-autosuggest/issues/28#issuecomment-110829653","issue_url":"https://api.github.com/repos/moroshko/react-autosuggest/issues/28","id":110829653,"user":{"login":"dnusca","id":1938793,"avatar_url":"https://avatars.githubusercontent.com/u/1938793?v=3","gravatar_id":"","url":"https://api.github.com/users/dnusca","html_url":"https://github.com/dnusca","followers_url":"https://api.github.com/users/dnusca/followers","following_url":"https://api.github.com/users/dnusca/following{/other_user}","gists_url":"https://api.github.com/users/dnusca/gists{/gist_id}","starred_url":"https://api.github.com/users/dnusca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dnusca/subscriptions","organizations_url":"https://api.github.com/users/dnusca/orgs","repos_url":"https://api.github.com/users/dnusca/repos","events_url":"https://api.github.com/users/dnusca/events{/privacy}","received_events_url":"https://api.github.com/users/dnusca/received_events","type":"User","site_admin":false},"created_at":"2015-06-10T16:47:57Z","updated_at":"2015-06-10T16:47:57Z","body":"@leishman This may help - https://github.com/moroshko/react-autosuggest/issues/14"}}