Skip to content

Commit

Permalink
refactor(useLockFn): catch to finally
Browse files Browse the repository at this point in the history
  • Loading branch information
coding-ice committed Dec 23, 2023
1 parent 6266eaa commit 44abc3d
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions packages/hooks/src/useLockFn/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ function useLockFn<P extends any[] = any[], V extends any = any>(fn: (...args: P
lockRef.current = true;
try {
const ret = await fn(...args);
lockRef.current = false;
return ret;
} catch (e) {
} finally {
lockRef.current = false;
throw e;
}
},
[fn],
Expand Down

0 comments on commit 44abc3d

Please sign in to comment.