Skip to content

Commit

Permalink
Layout URL parameter: all layouts are stable
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal committed Mar 14, 2024
1 parent 17efcaf commit 0e8954a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,7 @@ export default function PageTemplatesTemplateParts( { postType } ) {
const { params } = useLocation();
const { activeView = 'all', layout } = params;
const defaultView = useMemo( () => {
const usedType = window?.__experimentalAdminViews
? layout ?? DEFAULT_VIEW.type
: DEFAULT_VIEW.type;
const usedType = layout ?? DEFAULT_VIEW.type;
return {
...DEFAULT_VIEW,
type: usedType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,28 +101,12 @@ export default function useSyncPathWithURL() {
canvas: undefined,
path: navigatorLocation.path,
} );
} else if (
navigatorLocation.path === '/wp_template/all' &&
! window?.__experimentalAdminViews
) {
// When the experiment is disabled, we only support table layout.
// Clear it out from the URL, so layouts other than table cannot be accessed.
updateUrlParams( {
postType: undefined,
categoryType: undefined,
categoryId: undefined,
path: navigatorLocation.path,
layout: undefined,
} );
} else if (
// These sidebar paths are special in the sense that the url in these pages may or may not have a postId and we need to retain it if it has.
// The "type" property should be kept as well.
( navigatorLocation.path === '/pages' &&
window?.__experimentalAdminViews ) ||
( navigatorLocation.path === '/wp_template/all' &&
window?.__experimentalAdminViews ) ||
( navigatorLocation.path === '/wp_template_part/all' &&
window?.__experimentalAdminViews )
navigatorLocation.path === '/pages' ||
navigatorLocation.path === '/wp_template/all' ||
navigatorLocation.path === '/wp_template_part/all'
) {
updateUrlParams( {
postType: undefined,
Expand Down

0 comments on commit 0e8954a

Please sign in to comment.