redux-action-tools icon indicating copy to clipboard operation
redux-action-tools copied to clipboard

Redux Possible Unhandled Promise Rejection

Open StarHosea opened this issue 7 years ago • 1 comments

您好,刚接触Redux,React Native。 使用您的库如果异步Action发生错误,RN会warning : Possible Unhandled Promise Rejection。 发现 createAsyncAction 中,下面一行代码注释掉就没有warning了。

function createAsyncAction(type, payloadCreator, metaCreator) {
      .....
      return promise.then(value => {
              
      }, e => {
        dispatch(
          failedAction(e, getAsyncMeta(metaCreator, e, ASYNC_PHASES.FAILED))
        );
        return Promise.reject(e);//这里为什么还要返回错误呢
      });

}

StarHosea avatar Aug 24 '17 03:08 StarHosea

可以参考这两个issue的回答:

https://github.com/kpaxqin/redux-action-tools/issues/3 https://github.com/kpaxqin/redux-action-tools/issues/2

看来不少人有这个疑惑,我稍后考虑补全文档和示例

kpaxqin avatar Aug 24 '17 03:08 kpaxqin