Skip to content

Commit

Permalink
Add post support check
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad authored and ntsekouras committed May 27, 2024
1 parent 3d09a6a commit 52ebae2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/editor/src/components/post-actions/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1108,14 +1108,15 @@ export function usePostActions( postType, onActionPerformed ) {
].includes( postType );
const isPattern = postType === PATTERN_POST_TYPE;
const isLoaded = !! postTypeObject;
const supportsRevisions = !! postTypeObject?.supports?.revisions;
return useMemo( () => {
if ( ! isLoaded ) {
return [];
}

const actions = [
postTypeObject?.viewable && viewPostAction,
postRevisionsAction,
supportsRevisions && postRevisionsAction,
globalThis.IS_GUTENBERG_PLUGIN
? ! isTemplateOrTemplatePart &&
! isPattern &&
Expand Down Expand Up @@ -1181,5 +1182,6 @@ export function usePostActions( postType, onActionPerformed ) {
restorePostAction,
onActionPerformed,
isLoaded,
supportsRevisions,
] );
}

0 comments on commit 52ebae2

Please sign in to comment.