From a875163d9ff0853acfbd174f9b1758127e5fe452 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Thu, 9 Dec 2021 12:30:27 +0400 Subject: [PATCH] Site Editor: Fix edit template part link in header dropdown --- .../components/template-details/template-areas.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/edit-site/src/components/template-details/template-areas.js b/packages/edit-site/src/components/template-details/template-areas.js index 946ad8164a6e94..781c3006e41e70 100644 --- a/packages/edit-site/src/components/template-details/template-areas.js +++ b/packages/edit-site/src/components/template-details/template-areas.js @@ -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( { @@ -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 );