Skip to content

Commit

Permalink
Post Author - don't show 0 in inspector controls (#51345)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mcliwanow authored Jun 10, 2023
1 parent 3db3e4c commit d921d2a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/block-library/src/post-author/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ function PostAuthorEdit( {
};

const showCombobox = authorOptions.length >= minimumUsersForCombobox;
const showAuthorControl =
!! postId && ! isDescendentOfQueryLoop && authorOptions.length > 0;

return (
<>
<InspectorControls>
<PanelBody title={ __( 'Settings' ) }>
{ !! postId &&
! isDescendentOfQueryLoop &&
authorOptions.length &&
{ showAuthorControl &&
( ( showCombobox && (
<ComboboxControl
__nextHasNoMarginBottom
Expand Down

1 comment on commit d921d2a

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in d921d2a.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5227620890
📝 Reported issues:

Please sign in to comment.