Skip to content

Commit

Permalink
refactor(useLockFn): catch to finally (#2421)
Browse files Browse the repository at this point in the history
* refactor(useLockFn): catch to finally

* refactor(useLockFn): keep the throw e
  • Loading branch information
coding-ice committed Mar 13, 2024
1 parent 15afaa6 commit 866087a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/hooks/src/useLockFn/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ function useLockFn<P extends any[] = any[], V = any>(fn: (...args: P) => Promise
lockRef.current = true;
try {
const ret = await fn(...args);
lockRef.current = false;
return ret;
} catch (e) {
lockRef.current = false;
throw e;
} finally {
lockRef.current = false;
}
},
[fn],
Expand Down

0 comments on commit 866087a

Please sign in to comment.