{"action":"closed","issue":{"url":"https://api.github.com/repos/reactjs/react-redux/issues/396","repository_url":"https://api.github.com/repos/reactjs/react-redux","labels_url":"https://api.github.com/repos/reactjs/react-redux/issues/396/labels{/name}","comments_url":"https://api.github.com/repos/reactjs/react-redux/issues/396/comments","events_url":"https://api.github.com/repos/reactjs/react-redux/issues/396/events","html_url":"https://github.com/reactjs/react-redux/issues/396","id":157393205,"number":396,"title":"What about a disconnect function?","user":{"login":"landabaso","id":4365458,"avatar_url":"https://avatars.githubusercontent.com/u/4365458?v=3","gravatar_id":"","url":"https://api.github.com/users/landabaso","html_url":"https://github.com/landabaso","followers_url":"https://api.github.com/users/landabaso/followers","following_url":"https://api.github.com/users/landabaso/following{/other_user}","gists_url":"https://api.github.com/users/landabaso/gists{/gist_id}","starred_url":"https://api.github.com/users/landabaso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/landabaso/subscriptions","organizations_url":"https://api.github.com/users/landabaso/orgs","repos_url":"https://api.github.com/users/landabaso/repos","events_url":"https://api.github.com/users/landabaso/events{/privacy}","received_events_url":"https://api.github.com/users/landabaso/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-29T16:12:41Z","updated_at":"2016-05-29T16:18:59Z","closed_at":"2016-05-29T16:18:59Z","body":"Is it possible with the current API to disconnect and reconnect a component at the user convenience?\r\nWould a disconnect function be helpful?\r\n\r\nLet me show a case where it would help:\r\n\r\nIn an SPA I keep several \"Pages\" cached. That means they are still mounted, but hidden.\r\n\r\nBy doing that, it is very quick to re-display Pages that have been already visited since only a few updates are necessary. And the virtual dom does its job!\r\n\r\nSome of these Pages consist of large lists of redux-connected Items. These list Items are not rendered when not visible (because of shouldComponentUpdate). But after a few Pages are cached I end up having thousands of Items and the App gets slower.\r\n\r\nThe problem is that all Item wrappers (connect containers) are still being called for each item on every action. I end up having thousands of calls to each wrapped component. As I said no extra render happens but these thousands of calls make the app slow.\r\n\r\nIt would be nice if I could disconnect certain Item components (the ones that are not visible) so that they are not even called somehow. And to reconnect them later when the Page is going to be displayed again (I used to unmount / remount the whole but re-rendering was worse).\r\n\r\nI tried to find a way using redux-batched-subscribe but I believe that lib serves a different purpose.\r\n\r\nAre there any plans for a disconnect function or any way to achieve what I proposed?\r\n\r\nThanks!"}}
{"actor":{"display_login":"gaearon"}}