Skip to content

Commit 7390194

Browse files
committed
fix: onOK is not fired in withConfirmAction hoc
1 parent 75bd160 commit 7390194

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
# Changelog
44

5+
## 1.3.1
6+
7+
2025-8-1
8+
9+
### Bug Fixes
10+
11+
- 🐞 Fix `onOK` handler is not fired in `withConfirmAction` HOC.
12+
513
## 1.3.0
614

715
2025-7-28

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tiny-codes/react-easy",
3-
"version": "1.3.0",
3+
"version": "1.3.1",
44
"description": "Simplify React and AntDesign development with practical components and hooks",
55
"keywords": [
66
"react",

src/components/ConfirmAction/withConfirmAction.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ export function withConfirmActionInternal<
6363
const setOnOk: ActionCompConstraint['setOK'] = useCallback((handler) => {
6464
saveFuncRef.current = handler;
6565
}, []);
66+
const triggerOnOK = useCallback(async (...args: any[]) => {
67+
return saveFuncRef.current?.(...args);
68+
}, []);
6669

6770
// Merge the default ref and custom ref and output to the parent component
6871
useImperativeHandle(ref, () => {
@@ -76,7 +79,7 @@ export function withConfirmActionInternal<
7679
const triggerDom = (
7780
<ConfirmActionWithRef
7881
{...(propsWithDefaults as ConfirmActionProps<object, never>)}
79-
onOk={saveFuncRef.current}
82+
onOk={triggerOnOK}
8083
ref={actionRef}
8184
/>
8285
);

0 commit comments

Comments
 (0)