{"action":"created","issue":{"url":"https://api.github.com/repos/reactjs/react-redux/issues/530","repository_url":"https://api.github.com/repos/reactjs/react-redux","labels_url":"https://api.github.com/repos/reactjs/react-redux/issues/530/labels{/name}","comments_url":"https://api.github.com/repos/reactjs/react-redux/issues/530/comments","events_url":"https://api.github.com/repos/reactjs/react-redux/issues/530/events","html_url":"https://github.com/reactjs/react-redux/issues/530","id":185107407,"number":530,"title":"Sharing the same store with another Window","user":{"login":"sethcall","id":21948,"avatar_url":"https://avatars2.githubusercontent.com/u/21948?v=4","gravatar_id":"","url":"https://api.github.com/users/sethcall","html_url":"https://github.com/sethcall","followers_url":"https://api.github.com/users/sethcall/followers","following_url":"https://api.github.com/users/sethcall/following{/other_user}","gists_url":"https://api.github.com/users/sethcall/gists{/gist_id}","starred_url":"https://api.github.com/users/sethcall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sethcall/subscriptions","organizations_url":"https://api.github.com/users/sethcall/orgs","repos_url":"https://api.github.com/users/sethcall/repos","events_url":"https://api.github.com/users/sethcall/events{/privacy}","received_events_url":"https://api.github.com/users/sethcall/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-10-25T12:46:45Z","updated_at":"2018-02-09T12:52:05Z","closed_at":"2016-10-25T13:11:00Z","author_association":"NONE","body":"I have an iframe that I'd like to have re-use the parent window's store.\n\nIn my iframe, I have:\n\n```\n\nrender(\n        <Provider store={callerWindow.store}>\n            <Popup />\n        </Provider>,\n        document.getElementById('root')\n    )\n```\n\nWhere callerWindow.store is the store created in the parent window.\n\nHowever, when I change the state of something in the parent window store, the child/iframe does not re-render.   This makes sense to me as both windows have their own React instance... but I have no idea on how to somehow make React in the iframe get triggered/re-run (i.e., setState() called correctly) when the parent window's store changed.\n\nI'm thinking the secret must be in connect.js: https://github.com/reactjs/react-redux/blob/master/src/components/connect.js  \n\nStill looking.  Any pointers would be appreciated!\n"},"comment":{"url":"https://api.github.com/repos/reactjs/react-redux/issues/comments/364425590","html_url":"https://github.com/reactjs/react-redux/issues/530#issuecomment-364425590","issue_url":"https://api.github.com/repos/reactjs/react-redux/issues/530","id":364425590,"user":{"login":"jonshuttfd","id":32868343,"avatar_url":"https://avatars1.githubusercontent.com/u/32868343?v=4","gravatar_id":"","url":"https://api.github.com/users/jonshuttfd","html_url":"https://github.com/jonshuttfd","followers_url":"https://api.github.com/users/jonshuttfd/followers","following_url":"https://api.github.com/users/jonshuttfd/following{/other_user}","gists_url":"https://api.github.com/users/jonshuttfd/gists{/gist_id}","starred_url":"https://api.github.com/users/jonshuttfd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonshuttfd/subscriptions","organizations_url":"https://api.github.com/users/jonshuttfd/orgs","repos_url":"https://api.github.com/users/jonshuttfd/repos","events_url":"https://api.github.com/users/jonshuttfd/events{/privacy}","received_events_url":"https://api.github.com/users/jonshuttfd/received_events","type":"User","site_admin":false},"created_at":"2018-02-09T12:52:05Z","updated_at":"2018-02-09T12:52:05Z","author_association":"NONE","body":"Old post but I just solved this issue in my own app, which contains an iframe. The iframe then contains another react component). Both share the same store. \r\n\r\nmain react app sets a reference to the store on the window level:\r\n`if(document.getElementById('root')) {\r\n  **window.mystore = store**\r\n  render(\r\n    <Provider store={store}>\r\n      <App/>\r\n    </Provider>,\r\n    document.getElementById('root')\r\n  )\r\n}\r\n`\r\n\r\nThe when I initialize the react app within the iframe I simply reference the store on window.parent.mystore\r\n\r\n`if(document.getElementById('preview')) {\r\n  render(\r\n    <Provider store={**window.parent.mystore**}>\r\n      <Preview/>\r\n    </Provider>,\r\n    document.getElementById('preview')\r\n  )\r\n}`\r\n"}}
{"actor":{"display_login":"jonshuttfd"}}