diff --git a/packages/editor/src/components/post-author/combobox.js b/packages/editor/src/components/post-author/combobox.js index 867eca7947976a..9cc6e01f5b82ce 100644 --- a/packages/editor/src/components/post-author/combobox.js +++ b/packages/editor/src/components/post-author/combobox.js @@ -17,7 +17,8 @@ export default function PostAuthorCombobox() { const [ fieldValue, setFieldValue ] = useState(); const { editPost } = useDispatch( editorStore ); - const { authorId, authorOptions } = useAuthorsQuery( fieldValue ); + const { authorId, authorOptions, isLoading } = + useAuthorsQuery( fieldValue ); /** * Handle author selection. @@ -51,6 +52,7 @@ export default function PostAuthorCombobox() { onChange={ handleSelect } allowReset={ false } hideLabelFromVision + isLoading={ isLoading } /> ); } diff --git a/packages/editor/src/components/post-author/hook.js b/packages/editor/src/components/post-author/hook.js index f251eba79e1806..28c4c126547b82 100644 --- a/packages/editor/src/components/post-author/hook.js +++ b/packages/editor/src/components/post-author/hook.js @@ -14,9 +14,9 @@ import { store as editorStore } from '../../store'; import { AUTHORS_QUERY, BASE_QUERY } from './constants'; export function useAuthorsQuery( search ) { - const { authorId, authors, postAuthor } = useSelect( + const { authorId, authors, postAuthor, isLoading } = useSelect( ( select ) => { - const { getUser, getUsers } = select( coreStore ); + const { getUser, getUsers, isResolving } = select( coreStore ); const { getEditedPostAttribute } = select( editorStore ); const _authorId = getEditedPostAttribute( 'author' ); const query = { ...AUTHORS_QUERY }; @@ -30,6 +30,7 @@ export function useAuthorsQuery( search ) { authorId: _authorId, authors: getUsers( query ), postAuthor: getUser( _authorId, BASE_QUERY ), + isLoading: isResolving( 'getUsers', [ query ] ), }; }, [ search ] @@ -68,5 +69,5 @@ export function useAuthorsQuery( search ) { return [ ...currentAuthor, ...fetchedAuthors ]; }, [ authors, postAuthor ] ); - return { authorId, authorOptions, postAuthor }; + return { authorId, authorOptions, postAuthor, isLoading }; }