Skip to content

Commit

Permalink
Details page for parts: always go back to patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal committed Apr 11, 2024
1 parent cd580e7 commit c66a62e
Showing 1 changed file with 1 addition and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { __experimentalUseNavigator as useNavigator } from '@wordpress/component
import { useDispatch } from '@wordpress/data';
import { __ } from '@wordpress/i18n';
import { pencil } from '@wordpress/icons';
import { getQueryArgs } from '@wordpress/url';

/**
* Internal dependencies
Expand All @@ -17,27 +16,18 @@ import usePatternDetails from './use-pattern-details';
import { store as editSiteStore } from '../../store';
import { unlock } from '../../lock-unlock';
import TemplateActions from '../template-actions';
import { TEMPLATE_PART_POST_TYPE } from '../../utils/constants';

export default function SidebarNavigationScreenPattern() {
const navigator = useNavigator();
const {
params: { postType, postId },
} = navigator;
const { categoryType } = getQueryArgs( window.location.href );
const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );

useInitEditedEntityFromURL();

const patternDetails = usePatternDetails( postType, postId );

// The absence of a category type in the query params for template parts
// indicates the user has arrived at the template part via the "manage all"
// page and the back button should return them to that list page.
const backPath =
! categoryType && postType === TEMPLATE_PART_POST_TYPE
? '/wp_template_part/all'
: '/patterns';
const backPath = '/patterns';

return (
<SidebarNavigationScreen
Expand Down

0 comments on commit c66a62e

Please sign in to comment.