Skip to content

Redux Possible Unhandled Promise Rejection #4

@StarHosea

Description

@StarHosea

您好,刚接触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);//这里为什么还要返回错误呢
      });

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions