{"action":"created","issue":{"url":"https://api.github.com/repos/stylesuxx/generator-react-webpack-redux/issues/36","repository_url":"https://api.github.com/repos/stylesuxx/generator-react-webpack-redux","labels_url":"https://api.github.com/repos/stylesuxx/generator-react-webpack-redux/issues/36/labels{/name}","comments_url":"https://api.github.com/repos/stylesuxx/generator-react-webpack-redux/issues/36/comments","events_url":"https://api.github.com/repos/stylesuxx/generator-react-webpack-redux/issues/36/events","html_url":"https://github.com/stylesuxx/generator-react-webpack-redux/issues/36","id":170468579,"number":36,"title":"Redux + Thunk not working in Safari","user":{"login":"ammichael","id":6873880,"avatar_url":"https://avatars.githubusercontent.com/u/6873880?v=3","gravatar_id":"","url":"https://api.github.com/users/ammichael","html_url":"https://github.com/ammichael","followers_url":"https://api.github.com/users/ammichael/followers","following_url":"https://api.github.com/users/ammichael/following{/other_user}","gists_url":"https://api.github.com/users/ammichael/gists{/gist_id}","starred_url":"https://api.github.com/users/ammichael/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ammichael/subscriptions","organizations_url":"https://api.github.com/users/ammichael/orgs","repos_url":"https://api.github.com/users/ammichael/repos","events_url":"https://api.github.com/users/ammichael/events{/privacy}","received_events_url":"https://api.github.com/users/ammichael/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-08-10T17:06:37Z","updated_at":"2016-08-14T22:03:34Z","closed_at":"2016-08-14T22:03:34Z","body":"Hello there! \r\n\r\nThanks for the awesome generator. I've been using it for my projects and it's awesome.\r\n\r\nI ran into a strange bug. I'm using thunk as redux middleware so I can dispatch async actions, and it's working like a charm.. except in Safari. \r\n\r\nIn Safari it just doesn't work at all. Whatever async action I dispatch, it does dispatch the action, but it doesn't 'reach' the reducer. it's like thunk isn't working at all, and I've got no idea what is happening  here =(\r\n\r\nHere is the action:\r\n\r\n```\r\nimport {FETCH_MELHORES} from './../const';\r\nimport APIService from '../../services/APIService';\r\n\r\nmodule.exports = function(parameter) {\r\n  let quantidade = 7;\r\n  let offset = 0;\r\n\r\n  const ultimosPosts = APIService.fetchUltimosPosts(quantidade, offset);\r\n  console.log('fetchMelhores action')\r\n  return (dispatch) => {\r\n    ultimosPosts.then((data) => {\r\n      console.log('FETCH_MELHORES data:')\r\n      console.log(data)\r\n      dispatch({type: FETCH_MELHORES,\r\n                ultimosPosts: data,\r\n                parameter})\r\n    }).catch(err){\r\n      console.log('fetchMelhores fetch error')\r\n      console.log(err)\r\n    }\r\n  };\r\n};\r\n```\r\n\r\nAnd here the store/index.js:\r\n\r\n```\r\nimport { createStore, applyMiddleware, combineReducers, compose } from 'redux';\r\nimport thunk from 'redux-thunk';\r\n\r\nconst reducers = require('../reducers');\r\nconst createStoreWithMiddleware = applyMiddleware(thunk)(createStore);\r\n\r\nmodule.exports = function(initialState) {\r\n  // const store = createStoreWithMiddleware(reducers, initialState,\r\n  // window.devToolsExtension && window.devToolsExtension())\r\n\r\n  const store = createStore(\r\n    reducers,\r\n    initialState,\r\n    compose(\r\n      applyMiddleware(thunk)\r\n    )\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 nextReducer = require('../reducers')\r\n      store.replaceReducer(nextReducer)\r\n    })\r\n  }\r\n\r\n  return store\r\n}\r\n```\r\n\r\nAgain: it works perfectly in any browser, but not in Safari. Any ideas? 😞 "},"comment":{"url":"https://api.github.com/repos/stylesuxx/generator-react-webpack-redux/issues/comments/239700544","html_url":"https://github.com/stylesuxx/generator-react-webpack-redux/issues/36#issuecomment-239700544","issue_url":"https://api.github.com/repos/stylesuxx/generator-react-webpack-redux/issues/36","id":239700544,"user":{"login":"ammichael","id":6873880,"avatar_url":"https://avatars.githubusercontent.com/u/6873880?v=3","gravatar_id":"","url":"https://api.github.com/users/ammichael","html_url":"https://github.com/ammichael","followers_url":"https://api.github.com/users/ammichael/followers","following_url":"https://api.github.com/users/ammichael/following{/other_user}","gists_url":"https://api.github.com/users/ammichael/gists{/gist_id}","starred_url":"https://api.github.com/users/ammichael/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ammichael/subscriptions","organizations_url":"https://api.github.com/users/ammichael/orgs","repos_url":"https://api.github.com/users/ammichael/repos","events_url":"https://api.github.com/users/ammichael/events{/privacy}","received_events_url":"https://api.github.com/users/ammichael/received_events","type":"User","site_admin":false},"created_at":"2016-08-14T22:03:34Z","updated_at":"2016-08-14T22:03:34Z","body":"So what was happening: I was importing github's fetch polyfill into App.js and it worked in Chrome and Firefox. But not in Safari and IE.\r\n\r\nMy error."}}
{"actor":{"display_login":"ammichael"}}