-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add loading indicator to combo box control author selector #68927
base: trunk
Are you sure you want to change the base?
Add loading indicator to combo box control author selector #68927
Conversation
Note: the drop-down shows "No items found." during the search, a bug clearly visible currently (before this PR) when throttling the search callback. |
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
I updated the PR to avoid showing "No items found" string while the results are still loading. |
@@ -44,13 +45,14 @@ export default function PostAuthorCombobox() { | |||
<ComboboxControl | |||
__nextHasNoMarginBottom | |||
__next40pxDefaultSize | |||
label={ __( 'Author' ) } | |||
label={ __( 'Authorz' ) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ha, this was me trying to get my build working and not seeing changes. will revert!
@@ -157,7 +158,7 @@ export function SuggestionsList< | |||
); | |||
/* eslint-enable jsx-a11y/click-events-have-key-events */ | |||
} ) } | |||
{ suggestions.length === 0 && ( | |||
{ suggestions.length === 0 && ! isLoading && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SuggestionsList
component is shared, which is why we're passing the isLoading
prop, correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @adamsilverstein!
My suggestion is to limit new loading state changes to the ComboboxControl
. The FormTokenField
component is a bit tricky, as input and tokens can wrap on multiple lines. So, I'm not sure if the spinner suffix design will work for it.
Do you mind including a screenshot or screencast in the PR description?
Hopefully, the v2 design will account for the loading state of #64086.
cc @WordPress/gutenberg-components
Thanks for the review. I will add some screenshots/screencasts to show what this change does (when I am back at my desk Friday). I can also take a look at other consumers of the component to make sure they are unaffected. The main goal of the change here is to avoid showing "No items found" string while the (author) search is underway. Since it isn't directly related to adding a spinner, I can break it out into a follow up PR and we can explore the issue separately. |
I think it's okay to change the |
This PR is a rework of the effort in #27865 - see that ticket for additional details.
Testing instructions
Expected results:
Helpful wp-cli commands for testing:
Generate many users to test searching:
wp user generate --role=editor --count=100
Delete test users:
wp user delete $(wp user list --role=editor --field=ID) --reassign=2