{"action":"created","issue":{"url":"https://api.github.com/repos/tleunen/react-mdl/issues/339","repository_url":"https://api.github.com/repos/tleunen/react-mdl","labels_url":"https://api.github.com/repos/tleunen/react-mdl/issues/339/labels{/name}","comments_url":"https://api.github.com/repos/tleunen/react-mdl/issues/339/comments","events_url":"https://api.github.com/repos/tleunen/react-mdl/issues/339/events","html_url":"https://github.com/tleunen/react-mdl/issues/339","id":163328163,"number":339,"title":"[DataTable] Infinite loop in DataTable property onSelectionChanged","user":{"login":"xdvarpunen","id":2535272,"avatar_url":"https://avatars.githubusercontent.com/u/2535272?v=3","gravatar_id":"","url":"https://api.github.com/users/xdvarpunen","html_url":"https://github.com/xdvarpunen","followers_url":"https://api.github.com/users/xdvarpunen/followers","following_url":"https://api.github.com/users/xdvarpunen/following{/other_user}","gists_url":"https://api.github.com/users/xdvarpunen/gists{/gist_id}","starred_url":"https://api.github.com/users/xdvarpunen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xdvarpunen/subscriptions","organizations_url":"https://api.github.com/users/xdvarpunen/orgs","repos_url":"https://api.github.com/users/xdvarpunen/repos","events_url":"https://api.github.com/users/xdvarpunen/events{/privacy}","received_events_url":"https://api.github.com/users/xdvarpunen/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-07-01T06:30:19Z","updated_at":"2016-07-03T22:44:21Z","closed_at":"2016-07-03T22:41:25Z","body":"Hi,\r\n\r\nI have following problem: \r\nWhen I setState inside function I pass to onSelectionChanged, the function onSelectionChanged starts to call itself infinitely as loop.     \r\n\r\n```javascript\r\nrowSelectionChanged(data){\r\n    this.setState({\"rowsSelected\": data});\r\n}\r\nonSelectionChanged={this.rowSelectionChanged.bind(this)}\r\n```\r\n\r\nLink to code pen to see the test: http://codepen.io/xdvarpunen/pen/LkykVK?editors=1011 \r\n\r\nQuote from Discord react-mdl room:\r\n\r\n> @asdf Sorry for the delay, I tested your codepen (thanks for that) and I also noticed the infinite loop. This is caused by this line :/ https://github.com/tleunen/react-mdl/blob/master/src/DataTable/Selectable.js#L61\r\n> I first did this because if the table receives new data, the selected rows might change as well, so I wanted to notify the \"parent\". But yep it's not the best idea actually 😒 Would you mind creating a ticket issue for this specific bug please?\r\n> GitHub\r\n> tleunen/react-mdl\r\n> react-mdl - React Components for Material Design Lite\r\n> \r\n> Maybe the solution would just be to check if the selected rows has changed before calling the callback\r\n\r\n-XDVarpunen"},"comment":{"url":"https://api.github.com/repos/tleunen/react-mdl/issues/comments/230180103","html_url":"https://github.com/tleunen/react-mdl/issues/339#issuecomment-230180103","issue_url":"https://api.github.com/repos/tleunen/react-mdl/issues/339","id":230180103,"user":{"login":"tleunen","id":1972567,"avatar_url":"https://avatars.githubusercontent.com/u/1972567?v=3","gravatar_id":"","url":"https://api.github.com/users/tleunen","html_url":"https://github.com/tleunen","followers_url":"https://api.github.com/users/tleunen/followers","following_url":"https://api.github.com/users/tleunen/following{/other_user}","gists_url":"https://api.github.com/users/tleunen/gists{/gist_id}","starred_url":"https://api.github.com/users/tleunen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tleunen/subscriptions","organizations_url":"https://api.github.com/users/tleunen/orgs","repos_url":"https://api.github.com/users/tleunen/repos","events_url":"https://api.github.com/users/tleunen/events{/privacy}","received_events_url":"https://api.github.com/users/tleunen/received_events","type":"User","site_admin":false},"created_at":"2016-07-03T22:44:21Z","updated_at":"2016-07-03T22:44:21Z","body":"I'll try to make a bit more fixes and changes before releasing a new version early next week. Please be patient :)"}}
{"actor":{"display_login":"tleunen"}}