Skip to content

Commit

Permalink
Terms: Include only known terms in rendered input
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Mar 30, 2018
1 parent d78163d commit 25b782a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions editor/components/post-taxonomies/flat-term-selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,14 @@ class FlatTermSelector extends Component {
}

updateSelectedTerms( terms = [] ) {
const selectedTerms = terms.map( ( termId ) => {
const selectedTerms = terms.reduce( ( result, termId ) => {
const termObject = find( this.state.availableTerms, ( term ) => term.id === termId );
return termObject ? termObject.name : '';
} );
if ( termObject ) {
result.push( termObject.name );
}

return result;
}, [] );
this.setState( {
selectedTerms,
} );
Expand Down

0 comments on commit 25b782a

Please sign in to comment.