Skip to content

Commit

Permalink
Allow loading single pages or posts
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Feb 13, 2023
1 parent 1495f87 commit 85f8a69
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/e2e-tests/specs/performance/site-editor.test.js
Expand Up @@ -87,7 +87,11 @@ describe( 'Site Editor Performance', () => {
} );

beforeEach( async () => {
await visitSiteEditor( { postId: id, postType: 'page' } );
await visitSiteEditor( {
postId: id,
postType: 'page',
path: '/navigation/single',
} );
} );

it( 'Loading', async () => {
Expand Down
Expand Up @@ -12,7 +12,7 @@ import { useLocation } from '../routes';
import { store as editSiteStore } from '../../store';

export default function useInitEditedEntityFromURL() {
const { params: { postId, path = '/' } = {} } = useLocation();
const { params: { postId, postType, path = '/' } = {} } = useLocation();
const { isRequestingSite, homepageId } = useSelect( ( select ) => {
const { getSite } = select( coreDataStore );
const siteData = getSite();
Expand All @@ -37,6 +37,11 @@ export default function useInitEditedEntityFromURL() {
case '/template-parts/single':
setTemplatePart( postId );
break;
case '/navigation/single':
setPage( {
context: { postType, postId },
} );
break;
default: {
if ( homepageId ) {
setPage( {
Expand Down

0 comments on commit 85f8a69

Please sign in to comment.