Skip to content

Commit

Permalink
Ensure the parent post is among the available options.
Browse files Browse the repository at this point in the history
  • Loading branch information
adamsilverstein committed Oct 22, 2020
1 parent 79e57cc commit c3add15
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/editor/src/components/page-attributes/parent.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
debounce,
flatMap,
repeat,
find,
} from 'lodash';

/**
Expand Down Expand Up @@ -92,7 +93,14 @@ export function PageAttributesParent() {
} ) )
);
const opts = getOptionsFromTree( tree );
const itemsHaveParent = find( opts, item => item.value === parentPostId );
if ( parentPost && ! itemsHaveParent ) {
opts.unshift( {
value: parentPostId,
label: getTitle( parentPost ),
} );

}
return opts;
}, [ pageItems ] );

Expand Down

0 comments on commit c3add15

Please sign in to comment.