From fdd88a3b04a12b8cf60dfb3f441204b16c672999 Mon Sep 17 00:00:00 2001 From: Michal Iwanow <4765119+mcliwanow@users.noreply.github.com> Date: Sat, 10 Jun 2023 05:23:14 +0300 Subject: [PATCH] Post Author - don't show 0 in inspector controls (#51345) When user has no access to authors, authors array was empty and when used as `authorOptions.length`, React would render "0". Changing it to a boolean condition ensures that nothing is rendered instead. --- packages/block-library/src/post-author/edit.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/block-library/src/post-author/edit.js b/packages/block-library/src/post-author/edit.js index a9b7106f49d388..4ee353fdd9bdc0 100644 --- a/packages/block-library/src/post-author/edit.js +++ b/packages/block-library/src/post-author/edit.js @@ -93,14 +93,14 @@ function PostAuthorEdit( { }; const showCombobox = authorOptions.length >= minimumUsersForCombobox; + const showAuthorControl = + !! postId && ! isDescendentOfQueryLoop && authorOptions.length > 0; return ( <> - { !! postId && - ! isDescendentOfQueryLoop && - authorOptions.length && + { showAuthorControl && ( ( showCombobox && (