{"action":"created","issue":{"url":"https://api.github.com/repos/reactjs/redux/issues/667","repository_url":"https://api.github.com/repos/reactjs/redux","labels_url":"https://api.github.com/repos/reactjs/redux/issues/667/labels{/name}","comments_url":"https://api.github.com/repos/reactjs/redux/issues/667/comments","events_url":"https://api.github.com/repos/reactjs/redux/issues/667/events","html_url":"https://github.com/reactjs/redux/pull/667","id":104153101,"number":667,"title":"Change examples to explicitly use replaceReducer() for hot reloading","user":{"login":"gaearon","id":810438,"avatar_url":"https://avatars.githubusercontent.com/u/810438?v=3","gravatar_id":"","url":"https://api.github.com/users/gaearon","html_url":"https://github.com/gaearon","followers_url":"https://api.github.com/users/gaearon/followers","following_url":"https://api.github.com/users/gaearon/following{/other_user}","gists_url":"https://api.github.com/users/gaearon/gists{/gist_id}","starred_url":"https://api.github.com/users/gaearon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaearon/subscriptions","organizations_url":"https://api.github.com/users/gaearon/orgs","repos_url":"https://api.github.com/users/gaearon/repos","events_url":"https://api.github.com/users/gaearon/events{/privacy}","received_events_url":"https://api.github.com/users/gaearon/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":25,"created_at":"2015-08-31T23:26:42Z","updated_at":"2016-10-13T01:42:32Z","closed_at":"2015-08-31T23:30:11Z","pull_request":{"url":"https://api.github.com/repos/reactjs/redux/pulls/667","html_url":"https://github.com/reactjs/redux/pull/667","diff_url":"https://github.com/reactjs/redux/pull/667.diff","patch_url":"https://github.com/reactjs/redux/pull/667.patch"},"body":"This changes the examples to call `replaceReducer()` directly where appropriate instead of relying on the current “magic” behavior of React Redux.\r\n\r\nOn the surface, this contradicts #350, but the real intention behind #350 is to reduce the public API and remove “magic” from hot reloading because this magic often gets in the way (https://github.com/rackt/redux/issues/301, https://github.com/rackt/redux/issues/340).\r\n\r\nThis change lets us:\r\n\r\n* remove `getReducer()` completely from the Store public API, which is a win;\r\n* remove the magic around hot reloading, which is another win;\r\n* remove the need for `<Root>` component everywhere, and thus make examples simpler.\r\n\r\nWe can decide later whether or not we want to move ahead with something like #625 or not—it doesn't matter because whatever solution we end up with, we'll definitely force you to use HMR API directly for hot reloading, like in these examples.\r\n\r\nBecause *actually removing* `getReducer()` is a breaking change, we will do it separately (potentially with other breaking changes)."},"comment":{"url":"https://api.github.com/repos/reactjs/redux/issues/comments/253388545","html_url":"https://github.com/reactjs/redux/pull/667#issuecomment-253388545","issue_url":"https://api.github.com/repos/reactjs/redux/issues/667","id":253388545,"user":{"login":"cyberwombat","id":777498,"avatar_url":"https://avatars.githubusercontent.com/u/777498?v=3","gravatar_id":"","url":"https://api.github.com/users/cyberwombat","html_url":"https://github.com/cyberwombat","followers_url":"https://api.github.com/users/cyberwombat/followers","following_url":"https://api.github.com/users/cyberwombat/following{/other_user}","gists_url":"https://api.github.com/users/cyberwombat/gists{/gist_id}","starred_url":"https://api.github.com/users/cyberwombat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cyberwombat/subscriptions","organizations_url":"https://api.github.com/users/cyberwombat/orgs","repos_url":"https://api.github.com/users/cyberwombat/repos","events_url":"https://api.github.com/users/cyberwombat/events{/privacy}","received_events_url":"https://api.github.com/users/cyberwombat/received_events","type":"User","site_admin":false},"created_at":"2016-10-13T01:42:32Z","updated_at":"2016-10-13T01:42:32Z","body":"I was able to solve this warning by modifying the code from:\r\n````\r\nexport default function configureStore (initialState) {\r\n  const store = createStore(\r\n    reducers,\r\n    initialState,\r\n    applyMiddleware(...middleware)\r\n  )\r\n\r\n  if (module.hot) {\r\n    // Enable Webpack hot module replacement for reducers\r\n    module.hot.accept('../reducers', () => {\r\n      const nextRootReducer = require('../reducers/index')\r\n      store.replaceReducer(nextRootReducer)\r\n    })\r\n  }\r\n\r\n  return store\r\n}\r\n````\r\nTo:\r\n\r\n````\r\nexport default function configureStore (initialState) {\r\n  const store = createStore(\r\n    reducers,\r\n    initialState,\r\n    applyMiddleware(...middleware)\r\n  )\r\n\r\n  if (module.hot) {\r\n    // Enable Webpack hot module replacement for reducers\r\n    module.hot.accept('../reducers', () => {\r\n      store.replaceReducer(reducers)\r\n    })\r\n  }\r\n\r\n  return store\r\n}\r\n````"}}
{"actor":{"display_login":"cyberwombat"}}