From a1d39d995b8c2a60fa514e2aa4cdf028bdc9cfbc Mon Sep 17 00:00:00 2001 From: mauriac Date: Sun, 8 May 2022 00:39:33 +0100 Subject: [PATCH 1/2] Post Author block: Hide select author controle if there is no postId --- .../block-library/src/post-author/edit.js | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/packages/block-library/src/post-author/edit.js b/packages/block-library/src/post-author/edit.js index 8035d05638b3a..bc79e1a5341e6 100644 --- a/packages/block-library/src/post-author/edit.js +++ b/packages/block-library/src/post-author/edit.js @@ -70,28 +70,30 @@ function PostAuthorEdit( { <> - { ! isDescendentOfQueryLoop && !! authors?.length && ( - { - return { - value: id, - label: name, - }; - } ) } - onChange={ ( nextAuthorId ) => { - editEntityRecord( - 'postType', - postType, - postId, - { - author: nextAuthorId, - } - ); - } } - /> - ) } + { !! postId && + ! isDescendentOfQueryLoop && + !! authors?.length && ( + { + return { + value: id, + label: name, + }; + } ) } + onChange={ ( nextAuthorId ) => { + editEntityRecord( + 'postType', + postType, + postId, + { + author: nextAuthorId, + } + ); + } } + /> + ) } Date: Sun, 8 May 2022 00:47:10 +0100 Subject: [PATCH 2/2] Fix typo --- packages/block-library/src/post-author/edit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-library/src/post-author/edit.js b/packages/block-library/src/post-author/edit.js index bc79e1a5341e6..d214c505ffff1 100644 --- a/packages/block-library/src/post-author/edit.js +++ b/packages/block-library/src/post-author/edit.js @@ -74,7 +74,7 @@ function PostAuthorEdit( { ! isDescendentOfQueryLoop && !! authors?.length && ( { return {