{"action":"created","issue":{"url":"https://api.github.com/repos/callemall/material-ui/issues/5500","repository_url":"https://api.github.com/repos/callemall/material-ui","labels_url":"https://api.github.com/repos/callemall/material-ui/issues/5500/labels{/name}","comments_url":"https://api.github.com/repos/callemall/material-ui/issues/5500/comments","events_url":"https://api.github.com/repos/callemall/material-ui/issues/5500/events","html_url":"https://github.com/callemall/material-ui/issues/5500","id":186741264,"number":5500,"title":"closed ListItem TogglesNestedList will reopen when hover it parent","user":{"login":"starInEcust","id":5434131,"avatar_url":"https://avatars.githubusercontent.com/u/5434131?v=3","gravatar_id":"","url":"https://api.github.com/users/starInEcust","html_url":"https://github.com/starInEcust","followers_url":"https://api.github.com/users/starInEcust/followers","following_url":"https://api.github.com/users/starInEcust/following{/other_user}","gists_url":"https://api.github.com/users/starInEcust/gists{/gist_id}","starred_url":"https://api.github.com/users/starInEcust/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/starInEcust/subscriptions","organizations_url":"https://api.github.com/users/starInEcust/orgs","repos_url":"https://api.github.com/users/starInEcust/repos","events_url":"https://api.github.com/users/starInEcust/events{/privacy}","received_events_url":"https://api.github.com/users/starInEcust/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-02T08:44:12Z","updated_at":"2016-11-02T13:46:02Z","closed_at":null,"body":"### Problem description\r\n   @davincho @oliviertassinari  #4850 \r\n\r\n   I found a bug in ListItem component. \r\n   set second item's props open = true, then click it to hide the third one. When hover the first ListItem, the second will reopen automatically;\r\nI have read the source code and I found in line 421, handleMouseEnter will setState to change backgroundColor, but it will make child ListItem's componentWillReceiveProps setState according to it props in line 313\r\n   \r\n### working code that reproduces the issue is\r\n`\r\n<List style={styles.menuStyle}>\r\n                <ListItem\r\n                    open\r\n                    primaryText=\"1\"\r\n                    primaryTogglesNestedList\r\n                    nestedItems={[\r\n                        <ListItem\r\n                            open\r\n                            primaryText=\"2\"\r\n                            primaryTogglesNestedList\r\n                            nestedItems={[\r\n                                <ListItem\r\n                                    primaryText=\"3\"\r\n                                />,\r\n                            ]}\r\n                        />,\r\n                    ]}\r\n                />\r\n            </List>\r\n`\r\n\r\n### Versions\r\n\r\n- Material-UI:^0.16.1\r\n- React:^15.2.1\r\n- Browser: chrome 53\r\n"},"comment":{"url":"https://api.github.com/repos/callemall/material-ui/issues/comments/257868214","html_url":"https://github.com/callemall/material-ui/issues/5500#issuecomment-257868214","issue_url":"https://api.github.com/repos/callemall/material-ui/issues/5500","id":257868214,"user":{"login":"davincho","id":2635143,"avatar_url":"https://avatars.githubusercontent.com/u/2635143?v=3","gravatar_id":"","url":"https://api.github.com/users/davincho","html_url":"https://github.com/davincho","followers_url":"https://api.github.com/users/davincho/followers","following_url":"https://api.github.com/users/davincho/following{/other_user}","gists_url":"https://api.github.com/users/davincho/gists{/gist_id}","starred_url":"https://api.github.com/users/davincho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davincho/subscriptions","organizations_url":"https://api.github.com/users/davincho/orgs","repos_url":"https://api.github.com/users/davincho/repos","events_url":"https://api.github.com/users/davincho/events{/privacy}","received_events_url":"https://api.github.com/users/davincho/received_events","type":"User","site_admin":false},"created_at":"2016-11-02T13:46:02Z","updated_at":"2016-11-02T13:46:02Z","body":"If you use `open` attribute, be sure to assign it's value to a variable, otherwise the attribute's value will be uncontrolled. This means, as soon as a re-render happens `ListItem` will be opened again.\r\nAs shown in the example, you may register a callback with `onNestedListToggle` to reflect the toggled state within your component. Something like:\r\n\r\n```jsx\r\n<ListItem open={this.state.open} onNestedListToggle={this.toggleVariable} />\r\n```"}}
{"actor":{"display_login":"davincho"}}