From 60571345592519e9df26c3242b0160ea36ad2305 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Mon, 14 Feb 2022 06:40:57 +0000 Subject: [PATCH] Edit Site: Add template check to 'setPage' action (#38656) --- packages/edit-site/src/store/actions.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/edit-site/src/store/actions.js b/packages/edit-site/src/store/actions.js index 51d57819b387f2..96e909adc336f5 100644 --- a/packages/edit-site/src/store/actions.js +++ b/packages/edit-site/src/store/actions.js @@ -209,11 +209,17 @@ export function* setPage( page ) { page.path = getPathAndQueryString( entity.link ); } - const { id: templateId, slug: templateSlug } = yield controls.resolveSelect( + const template = yield controls.resolveSelect( coreStore, '__experimentalGetTemplateForLink', page.path ); + + if ( ! template ) { + return; + } + + const { id: templateId, slug: templateSlug } = template; yield { type: 'SET_PAGE', page: ! templateSlug