Skip to content

Commit

Permalink
Don't disable FormTokenField when loading term objects
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka committed Aug 11, 2021
1 parent 92fc682 commit 28dc96d
Showing 1 changed file with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,15 @@ function FlatTermSelector( { slug } ) {
terms,
termIds,
taxonomy,
isLoading,
hasAssignAction,
hasCreateAction,
} = useSelect(
( select ) => {
const { getCurrentPost, getEditedPostAttribute } = select(
editorStore
);
const { getEntityRecords, getTaxonomy, isResolving } = select(
coreStore
);
const { getEntityRecords, getTaxonomy } = select( coreStore );
const post = getCurrentPost();
const _taxonomy = getTaxonomy( slug );
const _termIds = _taxonomy
? getEditedPostAttribute( _taxonomy.rest_base )
Expand All @@ -119,7 +117,7 @@ function FlatTermSelector( { slug } ) {
return {
hasCreateAction: _taxonomy
? get(
getCurrentPost(),
post,
[
'_links',
'wp:action-create-' + _taxonomy.rest_base,
Expand All @@ -129,7 +127,7 @@ function FlatTermSelector( { slug } ) {
: false,
hasAssignAction: _taxonomy
? get(
getCurrentPost(),
post,
[
'_links',
'wp:action-assign-' + _taxonomy.rest_base,
Expand All @@ -142,11 +140,6 @@ function FlatTermSelector( { slug } ) {
terms: _termIds.length
? getEntityRecords( 'taxonomy', slug, query )
: EMPTY_ARRAY,
isLoading: isResolving( 'getEntityRecords', [
'taxonomy',
slug,
query,
] ),
};
},
[ slug ]
Expand Down Expand Up @@ -274,7 +267,6 @@ function FlatTermSelector( { slug } ) {
onChange={ onChange }
onInputChange={ debouncedSearch }
maxSuggestions={ MAX_TERMS_SUGGESTIONS }
disabled={ isLoading }
label={ newTermLabel }
messages={ {
added: termAddedLabel,
Expand Down

0 comments on commit 28dc96d

Please sign in to comment.