Editor: Add loading state to the 'PostAuthorCombobox' component#68991
Conversation
Co-authored-by: Marco Ciampini <marco.ciampo@gmail.com>
This reverts commit 76488c1.
|
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. |
| authorId: _authorId, | ||
| authors: getUsers( query ), | ||
| postAuthor: getUser( _authorId, BASE_QUERY ), | ||
| isLoading: isResolving( 'getUsers', [ query ] ), |
There was a problem hiding this comment.
Question (non-blocking): Should we track the loading state for every query or just for the search?
There was a problem hiding this comment.
Good question, my assumption was that search was the only async query, are there others?
If we did expand this to all queries, what would that look like? Does the isResolving call change?
There was a problem hiding this comment.
The initial query is also async, but I guess the loading state could also be a helpful hint.
Looks good to ship as it is ✅
…Press#68991) * Add loading indicator to author selector * Only show "No items found" when isLoading is false * Remove unitended change * Update packages/components/src/combobox-control/types.ts Co-authored-by: Marco Ciampini <marco.ciampo@gmail.com> * Revert "Only show "No items found" when isLoading is false" This reverts commit 76488c1. * Only show the suggestion list when the component isn’t loading data * Document `isLoading` prop in readme * Add is loading to Combobox storybook * Match readme description to type.js description * Revert combobox changes --------- Co-authored-by: Marco Ciampini <marco.ciampo@gmail.com>
|
@Mamaduka does this need any kind of dev note? |
|
@adamsilverstein, I don't think so. It's UI enhancement. Adding a storybook example as suggested in #68990 (comment) would be nice, but this can happen even after the release. |
…Press#68991) * Add loading indicator to author selector * Only show "No items found" when isLoading is false * Remove unitended change * Update packages/components/src/combobox-control/types.ts Co-authored-by: Marco Ciampini <marco.ciampo@gmail.com> * Revert "Only show "No items found" when isLoading is false" This reverts commit 76488c1. * Only show the suggestion list when the component isn’t loading data * Document `isLoading` prop in readme * Add is loading to Combobox storybook * Match readme description to type.js description * Revert combobox changes --------- Co-authored-by: Marco Ciampini <marco.ciampo@gmail.com>
What?
Add a loading indicator to the author dropdown. Fix a bug where it was impossible to tell a search was occuring, leating to poor UX especially over slower connections.
Follow up to #68990
Post author part of #68927
Testing instructions
Expected results:
Helpful wp-cli commands for testing:
Generate many users to test searching:
wp user generate --role=editor --count=100Delete test users:
wp user delete $(wp user list --role=editor --field=ID) --reassign=2Screencasts
Before changes (trunk)
before2.mp4
Add spinner
(note message "No items found" shows during search callback)
spinner-only.mp4
Final PR
(including removal of "No items found" during load)
after.mp4