diff --git a/packages/edit-site/src/components/page-templates/index.js b/packages/edit-site/src/components/page-templates/index.js index fd28c22298ba1..8a40646dcaef0 100644 --- a/packages/edit-site/src/components/page-templates/index.js +++ b/packages/edit-site/src/components/page-templates/index.js @@ -170,6 +170,18 @@ export default function DataviewsTemplates() { [ setTemplateId ] ); + const onDetailsChange = useCallback( + ( items ) => { + if ( items?.length === 1 ) { + history.push( { + postId: items[ 0 ].id, + postType: TEMPLATE_POST_TYPE, + } ); + } + }, + [ history ] + ); + const authors = useMemo( () => { if ( ! allTemplates ) { return EMPTY_ARRAY; @@ -363,6 +375,7 @@ export default function DataviewsTemplates() { view={ view } onChangeView={ onChangeView } onSelectionChange={ onSelectionChange } + onDetailsChange={ onDetailsChange } deferredRendering={ ! view.hiddenFields?.includes( 'preview' ) }