Nested Promise with setTimeout
问题 I have a nested promise. The promise resolves or rejects based on another promise resolving or rejecting with a setTimeout of 0 so as not to clog: return new Promise((resolve, reject) => { promiseInst .then(value => { executeSoon(() => { dispatch({ ...action, status: "done", value: value }); resolve(value); }); }) .catch(error => { executeSoon(() => { dispatch({ ...action, status: "error", error: error.message || error }); reject(error); }); }); }); the executeSoon() is executeSoon(fn) {