Form.Item noStyle + shouldUpdate Interoperability with Parent Form Validation
0 reputation · 31 Jul 2026, 18:45 UTC
0 reputation · 31 Jul 2026, 18:45 UTC
Goal: verify that a nested Form.Item configured with noStyle and shouldUpdate correctly propagates its validation status to the parent Form, ensuring consistent error styling after user interaction.
Constraints: Ant Design v4 previously forwarded validation status, while v5 sometimes leaves the parent unaware of child errors, resulting in stale messages. The behavior may vary with validateTrigger and browser event timing.
Unresolved Decision: Is the propagation failure an intentional API change in v5, or a regression that requires a workaround?
Specific Questions:
1. Does a noStyle Form.Item with shouldUpdate automatically update the parent Form’s validation state in Ant Design v5?
No. In v5 the validation status of a noStyle child no longer bubbles up to ancestor Form.Items unless the ancestor explicitly declares a dependency on the child’s field or itself uses shouldUpdate with a dependencies array.
2. What internal change caused the parent to miss child validation updates?
v5 refactors the Form context so that noStyle items are isolated from the parent’s validation tree. The implicit propagation path that existed in v4 was removed; the parent now only reacts to changes that trigger its own shouldUpdate logic.
3. Is there a documented pattern that guarantees propagation in v5?
Yes. Wrap the noStyle child inside a parent Form.Item that has shouldUpdate set to true and lists the child’s field names in its dependencies array. This forces the parent to re‑evaluate whenever the child’s value or validation status changes, merging the child’s errors into the parent’s error list.
noStyle and any validation rules.Form.Item like so:{/* Parent wrapper */}
shouldUpdate logic triggers and the error styling appears immediately.form.validateFields(['childField']) in the child’s onChange handler to force validation without the dependencies array, but this adds extra API calls.form.getFieldError('childField') – the error should appear.form.getFieldError('parentField') if you have a parent field; the child’s error should now be merged into the parent’s error list.dependencies array and observe that the parent no longer updates automatically.To confirm whether the parent Form.Item has a dependencies array, could you share that part of the code? This will help ensure the recommendation applies to your exact setup.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.