Skip to content

Commit

Permalink
Ensure state is always an array, properly
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbachhuber committed May 1, 2018
1 parent f112000 commit 80d0500
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
6 changes: 3 additions & 3 deletions core-data/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ export function terms( state = {}, action ) {
*
* @return {Object} Updated state.
*/
export function authors( state = {}, action ) {
export function authors( state = [], action ) {
switch ( action.type ) {
case 'RECEIVE_AUTHORS':
return {
return [
...state,
...action.authors,
};
];
}

return state;
Expand Down
1 change: 0 additions & 1 deletion editor/components/post-author/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import PostTypeSupportCheck from '../post-type-support-check';

export function PostAuthorCheck( { user, authors, children } ) {
const userCanPublishPosts = get( user.data, [ 'post_type_capabilities', 'publish_posts' ], false );
authors = castArray( authors );

if ( ! userCanPublishPosts || authors.length < 2 ) {
return null;
Expand Down

0 comments on commit 80d0500

Please sign in to comment.