Skip to content

Commit 03b4189

Browse files
fix(Form): sync onValuesChange callback to fix state timing (#4217)
* fix(Form): sync onValuesChange callback to fix state timing in React 19 * chore: stash changelog [ci skip] --------- Co-authored-by: tdesign-bot <tdesign@tencent.com>
1 parent b652fdd commit 03b4189

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

packages/components/form/Form.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,8 @@ const Form = forwardRefWithStatics(
7777
}
7878

7979
function onFormItemValueChange(changedValue: Record<string, unknown>) {
80-
requestAnimationFrame(() => {
81-
const allFields = formInstance.getFieldsValue(true);
82-
onValuesChange(changedValue, allFields);
83-
});
80+
const allFields = formInstance.getFieldsValue(true);
81+
onValuesChange(changedValue, allFields);
8482
}
8583

8684
return (
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
pr_number: 4217
3+
contributor: RylanBot
4+
---
5+
6+
- feat(Form): 修复 `onValueChange` 不稳定的问题 @RylanBot ([#4217](https://github.com/Tencent/tdesign-react/pull/4217))

0 commit comments

Comments
 (0)