diff --git a/packages/dataviews/src/components/dataform/index.tsx b/packages/dataviews/src/components/dataform/index.tsx
index b359ddba74381e..63eb4f212b10f9 100644
--- a/packages/dataviews/src/components/dataform/index.tsx
+++ b/packages/dataviews/src/components/dataform/index.tsx
@@ -16,13 +16,14 @@ export default function DataForm< Item >( {
form,
fields,
onChange,
+ isLoading = false,
}: DataFormProps< Item > ) {
const normalizedFields = useMemo(
() => normalizeFields( fields ),
[ fields ]
);
- if ( ! form.fields ) {
+ if ( ! form.fields || isLoading ) {
return null;
}
diff --git a/packages/dataviews/src/types.ts b/packages/dataviews/src/types.ts
index 96fd4a8cd01afc..cfb5e418a60c90 100644
--- a/packages/dataviews/src/types.ts
+++ b/packages/dataviews/src/types.ts
@@ -543,6 +543,7 @@ export interface DataFormProps< Item > {
fields: Field< Item >[];
form: Form;
onChange: ( value: Record< string, any > ) => void;
+ isLoading?: boolean;
}
export interface FieldLayoutProps< Item > {
diff --git a/packages/edit-site/src/components/post-edit/index.js b/packages/edit-site/src/components/post-edit/index.js
index b3954e4ddbdeaf..0717ce9b33dd28 100644
--- a/packages/edit-site/src/components/post-edit/index.js
+++ b/packages/edit-site/src/components/post-edit/index.js
@@ -35,17 +35,22 @@ const fieldsWithBulkEditSupport = [
function PostEditForm( { postType, postId } ) {
const ids = useMemo( () => postId.split( ',' ), [ postId ] );
- const { record } = useSelect(
+ const { record, hasFinishedResolution } = useSelect(
( select ) => {
+ const args = [ 'postType', postType, ids[ 0 ] ];
+
+ const {
+ getEditedEntityRecord,
+ hasFinishedResolution: hasFinished,
+ } = select( coreDataStore );
+
return {
record:
- ids.length === 1
- ? select( coreDataStore ).getEditedEntityRecord(
- 'postType',
- postType,
- ids[ 0 ]
- )
- : null,
+ ids.length === 1 ? getEditedEntityRecord( ...args ) : null,
+ hasFinishedResolution: hasFinished(
+ 'getEditedEntityRecord',
+ args
+ ),
};
},
[ postType, ids ]
@@ -162,6 +167,7 @@ function PostEditForm( { postType, postId } ) {