reactjs - Redux-saga 与 Internet Explorer

标签 reactjs redux react-redux redux-saga react-boilerplate

我有一个在 IE 11 中使用 redux-saga 的 React 应用

它似乎因以下错误而中断

请注意,此应用在过去 3 年的 Chrome 版本和 Safari 中运行得非常好(除了一些显示问题)

sagas.js

// functions are called bottom to top, this one is called at the end (also can be seen in stack trace below)

function* getGlobalData() {
    console.log('Get global data called');      // this is executed

    // something is failing from here on

    const [
      wardrobeResponse,
      lastListingsResponse,
    ]  = yield [
      call(api_request, {url: 'store/wardrobes/'}),
      call(api_request, {url: 'store/last_listings/'}),
    ]


    yield put(actions.wardrobe.success(wardrobeResponse.json));
    yield put(actions.lastListings.success(lastListingsResponse.json));



}

/**
 * Watches for LOAD_SEARCH_RESULTS action and calls handler
 */
function* getGlobalDataWatcher() {

    console.log('Get data - check if working');
    console.log("global data watcher saga run")
    yield take(Constants.LOAD_GLOBAL_DATA)
    console.log('LOAD_GLOBAL_DATA received in saga')
    const state = yield select()

      if (state.getIn(['global', 'wardrobes']).isEmpty()) {
          console.log('Empty global data, call api')
          yield call(getGlobalData);
      } else {
          console.log('Global data already present, dont call API')
      }

}




function* data() {
  console.log('Get global results saga data called');
  yield fork(getGlobalDataWatcher);
}


export default [
  data
]

控制台错误

uncaught at data 
 at loadMeDataWatcher 
 at loadMeData 
 TypeError: Object doesn't support this action
   at api_request (http://localhost:3002/main.js:5905:3)
   at runCallEffect (eval code:446:7)
   at runEffect (eval code:370:5)
   at next (eval code:259:9)
   at currCb (eval code:329:7)
   at runSelectEffect (eval code:651:7)
   at runEffect (eval code:370:5)
   at next (eval code:259:9)
   at proc (eval code:214:3)
   at resolveIterator (eval code:390:5)

最佳答案

您可以将“babel-polyfill”安装到您的依赖项中,并将此行添加到您的 app.js 中。

import 'babel-polyfill'; 

See more

关于reactjs - Redux-saga 与 Internet Explorer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40273043/

相关文章:

reactjs - React router 4 History.listen 永远不会触发

javascript - React.js 错误 : Invariant Violation: Minified React error #37

javascript - 使用 React-Redux 的生命游戏

javascript - Nextjs 第一次运行时报错 : Error: Cannot find module 'caniuse-lite/data/features/css-unicode-bidi'

javascript - Redux:使用 thunk 中间件和 combineReducers 为 getState 引入了额外的键

javascript - 在 redux 中复制大状态不会降低性能吗?

javascript - React-Redux TypeScript 错误

reactjs - 您如何使用 webpack 和服务器端渲染的 React 处理缓存破坏 SVG?

reactjs - 在 react redux 中 action 和 reducer 如何相互连接

reactjs - 如何禁用 react 按钮直到 Meteor Method 完成