From 5a4a4ef254ec497e786da822498d90b16d0e5ba4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9?= <583546+oandregal@users.noreply.github.com>
Date: Tue, 26 Aug 2025 18:52:23 +0200
Subject: [PATCH 01/20] Revert "DataForm: Streamline validation behavior
(#71345)" (#71359)
This reverts commit 55d79f3c6fda4bfa3071bbe92ed06b1ef5011d5f.
---
packages/dataviews/CHANGELOG.md | 4 ---
packages/dataviews/README.md | 4 +--
.../src/components/dataform/index.tsx | 23 +----------------
.../dataform/stories/index.story.tsx | 14 +++++------
packages/dataviews/src/test/dataform.tsx | 25 ++++++-------------
packages/dataviews/src/types.ts | 5 +---
packages/fields/src/actions/reorder-page.tsx | 15 ++++++-----
7 files changed, 25 insertions(+), 65 deletions(-)
diff --git a/packages/dataviews/CHANGELOG.md b/packages/dataviews/CHANGELOG.md
index 72ee147e674032..5dac1b82db9fc2 100644
--- a/packages/dataviews/CHANGELOG.md
+++ b/packages/dataviews/CHANGELOG.md
@@ -10,10 +10,6 @@
- DataViews: Fix incorrect documentation for `defaultLayouts` prop. [#71334](https://github.com/WordPress/gutenberg/pull/71334)
-### Enhancements
-
-- DataForm: Add second argument to the `onChange` callback that contains an `isValid` boolean property and remove `isItemValid` utility. [#71345](https://github.com/WordPress/gutenberg/pull/71345)
-
## 7.0.0 (2025-08-20)
### Breaking changes
diff --git a/packages/dataviews/README.md b/packages/dataviews/README.md
index 7d4edd31538aec..da831d39a8a14c 100644
--- a/packages/dataviews/README.md
+++ b/packages/dataviews/README.md
@@ -586,7 +586,7 @@ const form = {
#### `onChange`: `function`
-Callback function that receives an object with the edits done by the user. It also receives a second parameter that indicates whether the current item is valid or not according to the current fields and form configuration.
+Callback function that receives an object with the edits done by the user.
Example:
@@ -598,7 +598,7 @@ const data = {
date: '2012-04-23T18:25:43.511Z',
};
-const onChange = ( edits, { isValid } ) => {
+const onChange = ( edits ) => {
/*
* edits will contain user edits.
* For example, if the user edited the title
diff --git a/packages/dataviews/src/components/dataform/index.tsx b/packages/dataviews/src/components/dataform/index.tsx
index 39e88050b8da80..b359ddba74381e 100644
--- a/packages/dataviews/src/components/dataform/index.tsx
+++ b/packages/dataviews/src/components/dataform/index.tsx
@@ -10,7 +10,6 @@ import type { DataFormProps } from '../../types';
import { DataFormProvider } from '../dataform-context';
import { normalizeFields } from '../../normalize-fields';
import { DataFormLayout } from '../../dataforms-layouts/data-form-layout';
-import { isItemValid } from '../../validation';
export default function DataForm< Item >( {
data,
@@ -23,33 +22,13 @@ export default function DataForm< Item >( {
[ fields ]
);
- const onChangeWithValidation = ( updatedData: Partial< Item > ) => {
- if ( ! onChange ) {
- return;
- }
-
- const isValid = isItemValid(
- {
- ...data,
- ...updatedData,
- },
- fields,
- form
- );
- onChange( updatedData, { isValid } );
- };
-
if ( ! form.fields ) {
return null;
}
return (