{"action":"created","issue":{"url":"https://api.github.com/repos/jwoudenberg/flyd-lift-react/issues/2","labels_url":"https://api.github.com/repos/jwoudenberg/flyd-lift-react/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/jwoudenberg/flyd-lift-react/issues/2/comments","events_url":"https://api.github.com/repos/jwoudenberg/flyd-lift-react/issues/2/events","html_url":"https://github.com/jwoudenberg/flyd-lift-react/issues/2","id":117308451,"number":2,"title":"setState warning","user":{"login":"qur2","id":143227,"avatar_url":"https://avatars.githubusercontent.com/u/143227?v=3","gravatar_id":"","url":"https://api.github.com/users/qur2","html_url":"https://github.com/qur2","followers_url":"https://api.github.com/users/qur2/followers","following_url":"https://api.github.com/users/qur2/following{/other_user}","gists_url":"https://api.github.com/users/qur2/gists{/gist_id}","starred_url":"https://api.github.com/users/qur2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qur2/subscriptions","organizations_url":"https://api.github.com/users/qur2/orgs","repos_url":"https://api.github.com/users/qur2/repos","events_url":"https://api.github.com/users/qur2/events{/privacy}","received_events_url":"https://api.github.com/users/qur2/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-17T08:41:02Z","updated_at":"2015-11-28T13:11:22Z","closed_at":null,"body":"Hi,\r\n\r\nI'm using your library in a case that is a bit different than what I see in the tests: I have a higher component that builds subcomponents and injects streams into them. This means that the lifting happens inside in a `render()` call.\r\nThe problem is that while lifting a component, `.setState()` is called and React emits a warning because the state is mutated during a render cycle. Of course, it's only a warning, but it would be nice to get rid of it.\r\nSo far, the fix I found is to wrap the `.setState()` call in a function that checks that the new state is different from the component state. In order to do that, I use `ramda.equals()` which has the benefit to delegate to `state.equals` if there is any (and thus benefits from fast comparison with immutablejs for example). The drawback, obviously, is that the library would have ramda as a dependency. I find it acceptable since flyd already depends on it.\r\n\r\nWhat do you think? Would a PR be welcome?"},"comment":{"url":"https://api.github.com/repos/jwoudenberg/flyd-lift-react/issues/comments/160294834","html_url":"https://github.com/jwoudenberg/flyd-lift-react/issues/2#issuecomment-160294834","issue_url":"https://api.github.com/repos/jwoudenberg/flyd-lift-react/issues/2","id":160294834,"user":{"login":"jwoudenberg","id":1525551,"avatar_url":"https://avatars.githubusercontent.com/u/1525551?v=3","gravatar_id":"","url":"https://api.github.com/users/jwoudenberg","html_url":"https://github.com/jwoudenberg","followers_url":"https://api.github.com/users/jwoudenberg/followers","following_url":"https://api.github.com/users/jwoudenberg/following{/other_user}","gists_url":"https://api.github.com/users/jwoudenberg/gists{/gist_id}","starred_url":"https://api.github.com/users/jwoudenberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwoudenberg/subscriptions","organizations_url":"https://api.github.com/users/jwoudenberg/orgs","repos_url":"https://api.github.com/users/jwoudenberg/repos","events_url":"https://api.github.com/users/jwoudenberg/events{/privacy}","received_events_url":"https://api.github.com/users/jwoudenberg/received_events","type":"User","site_admin":false},"created_at":"2015-11-28T13:11:22Z","updated_at":"2015-11-28T13:11:22Z","body":"Hey there. Sorry for the late response, for some reason I just found out about this issue. Anyways, I think the core of the problem is that `flyd.on()` gets called synchronously with the initial value of the stream, which is a bit superfluous considering that's the value we've already set that value on the state in the `getInitialState()` method.\r\n\r\nThis is both the reason your solution and the reason I think it's overkill ;). The way I see it, if we ignore that initial call to `flyd.on()`, we're done. You can still use do a `shouldComponentRender` check of course, but in my eyes that should be the responsibility of a separate HOC (one that I see no reason shouldn't play nice with this one).\r\n\r\nI'll give this a look and report back here when I find a solution :)."}}