避免钱包清理产生未处理拒绝
使用同时处理成功与失败的 Promise 回调清理活动请求,避免 finally 派生拒绝无人观察。
This commit is contained in:
@@ -133,14 +133,15 @@ export function createProfileWalletStore(
|
||||
})();
|
||||
activeRefresh = refresh;
|
||||
activeAbortController = abortController;
|
||||
void refresh.finally(() => {
|
||||
const clearActiveRefresh = () => {
|
||||
if (activeRefresh === refresh) {
|
||||
activeRefresh = null;
|
||||
}
|
||||
if (activeAbortController === abortController) {
|
||||
activeAbortController = null;
|
||||
}
|
||||
});
|
||||
};
|
||||
void refresh.then(clearActiveRefresh, clearActiveRefresh);
|
||||
return refresh;
|
||||
},
|
||||
resetWalletBalance: () => {
|
||||
|
||||
Reference in New Issue
Block a user