-
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
Editor: Add loading state to the 'PostAuthorCombobox' component #68991
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. |
@@ -30,6 +30,7 @@ export function useAuthorsQuery( search ) { | |||
authorId: _authorId, | |||
authors: getUsers( query ), | |||
postAuthor: getUser( _authorId, BASE_QUERY ), | |||
isLoading: isResolving( 'getUsers', [ query ] ), |
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.
Question (non-blocking): Should we track the loading state for every query or just for the search?
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 ✅
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.
This should be good to merge after #68990.
Left one question, but it's not a blocker.
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=100
Delete test users:
wp user delete $(wp user list --role=editor --field=ID) --reassign=2
Screencasts
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