Skip to content

Commit

Permalink
Add inline comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Jun 21, 2024
1 parent 9a28074 commit 3dce17e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/editor/src/components/post-actions/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,12 +309,12 @@ const trashPostAction = {

function useTrashPostAction( postType ) {
const registry = useRegistry();
const { resource, canUserResolvers } = useSelect(
const { resource, cachedCanUserResolvers } = useSelect(
( select ) => {
const { getPostType, getCachedResolvers } = select( coreStore );
return {
resource: getPostType( postType )?.rest_base || '',
canUserResolvers: getCachedResolvers().canUser,
cachedCanUserResolvers: getCachedResolvers().canUser,
};
},
[ postType ]
Expand All @@ -331,8 +331,10 @@ function useTrashPostAction( postType ) {
);
},
} ),
// We are making this use memo depend on cachedCanUserResolvers as a way to make the component using this hook re-render
// when user capabilities are resolved. This makes sure the isEligible function is re-evaluated.
// eslint-disable-next-line react-hooks/exhaustive-deps
[ registry, resource, canUserResolvers ]
[ registry, resource, cachedCanUserResolvers ]
);
}

Expand Down Expand Up @@ -1143,9 +1145,7 @@ export function usePostActions( { postType, onActionPerformed, context } ) {
isPattern,
postTypeObject?.viewable,
duplicatePostAction,
permanentlyDeletePostAction,
trashPostActionForPostType,
restorePostAction,
onActionPerformed,
isLoaded,
supportsRevisions,
Expand Down

0 comments on commit 3dce17e

Please sign in to comment.