Skip to content

Commit

Permalink
Site Editor: Fix edit template part link in header dropdown (#37249)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka authored and noisysocks committed Dec 13, 2021
1 parent 5565a2e commit f703276
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { moreVertical } from '@wordpress/icons';
*/
import { store as editSiteStore } from '../../store';
import isTemplateRevertable from '../../utils/is-template-revertable';
import { useLocation } from '../routes';
import { useLink } from '../routes/link';

function TemplatePartItemMore( {
Expand All @@ -21,10 +22,16 @@ function TemplatePartItemMore( {
closeTemplateDetailsDropdown,
} ) {
const { revertTemplate } = useDispatch( editSiteStore );
const editLinkProps = useLink( {
postId: templatePart.id,
postType: templatePart.type,
} );
const { params } = useLocation();
const editLinkProps = useLink(
{
postId: templatePart.id,
postType: templatePart.type,
},
{
fromTemplateId: params.postId,
}
);

function editTemplatePart( event ) {
editLinkProps.onClick( event );
Expand Down

0 comments on commit f703276

Please sign in to comment.