{"action":"created","issue":{"url":"https://api.github.com/repos/Yomguithereal/baobab-react/issues/54","labels_url":"https://api.github.com/repos/Yomguithereal/baobab-react/issues/54/labels{/name}","comments_url":"https://api.github.com/repos/Yomguithereal/baobab-react/issues/54/comments","events_url":"https://api.github.com/repos/Yomguithereal/baobab-react/issues/54/events","html_url":"https://github.com/Yomguithereal/baobab-react/issues/54","id":78234275,"number":54,"title":"ReferenceError: document is not defined when doing server rendering","user":{"login":"kompot","id":231635,"avatar_url":"https://avatars.githubusercontent.com/u/231635?v=3","gravatar_id":"","url":"https://api.github.com/users/kompot","html_url":"https://github.com/kompot","followers_url":"https://api.github.com/users/kompot/followers","following_url":"https://api.github.com/users/kompot/following{/other_user}","gists_url":"https://api.github.com/users/kompot/gists{/gist_id}","starred_url":"https://api.github.com/users/kompot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kompot/subscriptions","organizations_url":"https://api.github.com/users/kompot/orgs","repos_url":"https://api.github.com/users/kompot/repos","events_url":"https://api.github.com/users/kompot/events{/privacy}","received_events_url":"https://api.github.com/users/kompot/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-19T20:14:26Z","updated_at":"2015-05-25T11:46:46Z","closed_at":null,"body":"Hi, I got the following when doing server render\r\n\r\n```\r\n/Users/kompot/projects/bm/front/node_modules/react/lib/getActiveElement.js:23\r\n    return document.body;\r\n           ^\r\nReferenceError: document is not defined\r\n    at getActiveElement (/Users/kompot/projects/bm/front/node_modules/react/lib/getActiveElement.js:23:12)\r\n    at ReactReconcileTransaction.ReactInputSelection.getSelectionInformation (/Users/kompot/projects/bm/front/node_modules/react/lib/ReactInputSelection.js:40:23)\r\n    at ReactReconcileTransaction.Mixin.initializeAll (/Users/kompot/projects/bm/front/node_modules/react/lib/Transaction.js:168:30)\r\n    at ReactReconcileTransaction.Mixin.perform (/Users/kompot/projects/bm/front/node_modules/react/lib/Transaction.js:133:12)\r\n    at ReactUpdatesFlushTransaction.Mixin.perform (/Users/kompot/projects/bm/front/node_modules/react/lib/Transaction.js:134:20)\r\n    at ReactUpdatesFlushTransaction.assign.perform (/Users/kompot/projects/bm/front/node_modules/react/lib/ReactUpdates.js:95:38)\r\n    at Object.flushBatchedUpdates (/Users/kompot/projects/bm/front/node_modules/react/lib/ReactUpdates.js:175:19)\r\n    at Object.wrapper [as flushBatchedUpdates] (/Users/kompot/projects/bm/front/node_modules/react/lib/ReactPerf.js:70:21)\r\n    at ReactDefaultBatchingStrategyTransaction.Mixin.closeAll (/Users/kompot/projects/bm/front/node_modules/react/lib/Transaction.js:207:25)\r\n    at ReactDefaultBatchingStrategyTransaction.Mixin.perform (/Users/kompot/projects/bm/front/node_modules/react/lib/Transaction.js:148:16)\r\n    at Object.ReactDefaultBatchingStrategy.batchedUpdates (/Users/kompot/projects/bm/front/node_modules/react/lib/ReactDefaultBatchingStrategy.js:66:19)\r\n    at Object.enqueueUpdate (/Users/kompot/projects/bm/front/node_modules/react/lib/ReactUpdates.js:215:22)\r\n    at enqueueUpdate (/Users/kompot/projects/bm/front/node_modules/react/lib/ReactUpdateQueue.js:30:18)\r\n    at Object.ReactUpdateQueue.enqueueSetState (/Users/kompot/projects/bm/front/node_modules/react/lib/ReactUpdateQueue.js:208:5)\r\n    at ComposedComponent.ReactComponent.setState (/Users/kompot/projects/bm/front/node_modules/react/lib/ReactComponent.js:69:20)\r\n    at ComposedComponent.<anonymous> (/Users/kompot/projects/bm/front/node_modules/baobab-react/dist-modules/higher-order.js:135:16)\r\n```\r\n\r\n`higher-order.js:135:16` is this line\r\nhttps://github.com/Yomguithereal/baobab-react/blob/master/src/higher-order.js#L83\r\n\r\nFound this (probably related) issue\r\nhttps://github.com/facebook/react/issues/3620\r\nin React repository.\r\n\r\nAny thoughts how that could be fixed?"},"comment":{"url":"https://api.github.com/repos/Yomguithereal/baobab-react/issues/comments/105216315","html_url":"https://github.com/Yomguithereal/baobab-react/issues/54#issuecomment-105216315","issue_url":"https://api.github.com/repos/Yomguithereal/baobab-react/issues/54","id":105216315,"user":{"login":"Yomguithereal","id":2571951,"avatar_url":"https://avatars.githubusercontent.com/u/2571951?v=3","gravatar_id":"","url":"https://api.github.com/users/Yomguithereal","html_url":"https://github.com/Yomguithereal","followers_url":"https://api.github.com/users/Yomguithereal/followers","following_url":"https://api.github.com/users/Yomguithereal/following{/other_user}","gists_url":"https://api.github.com/users/Yomguithereal/gists{/gist_id}","starred_url":"https://api.github.com/users/Yomguithereal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yomguithereal/subscriptions","organizations_url":"https://api.github.com/users/Yomguithereal/orgs","repos_url":"https://api.github.com/users/Yomguithereal/repos","events_url":"https://api.github.com/users/Yomguithereal/events{/privacy}","received_events_url":"https://api.github.com/users/Yomguithereal/received_events","type":"User","site_admin":false},"created_at":"2015-05-25T11:46:46Z","updated_at":"2015-05-25T11:46:46Z","body":"Hello @kompot. If I recall correctly, serverside rendering with `react` doesn't allow for component's lifecycle and state changes etc. This means you should provide a final tree to your app to render the desired state on the server before serving to the client. But I guess your use case is a bit more complicated. Are you performing data fecthing on the server the same way you do on the client?\r\n\r\nFor what it's worth, and I think this should be considered as a hack: [this](https://github.com/Yomguithereal/baobab-react/blob/master/test/endpoint.js#L26-L34) is how I use jsdom and make react think I can use the DOM when testing `baobab-react`.\r\n\r\nCould you develop your use case a bit more here so we can advance on it together?"}}