Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataViews: make list layout stable #59858

Merged
merged 3 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions packages/edit-site/src/components/layout/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,7 @@ export default function useLayoutAreas() {
};
}

// List layout is still experimental.
// Extracted it here out of the conditionals so it doesn't unintentionally becomes stable.
const isListLayout =
isCustom !== 'true' &&
layout === 'list' &&
window?.__experimentalAdminViews;
const isListLayout = isCustom !== 'true' && layout === 'list';

if ( path === '/pages' ) {
return {
Expand Down
4 changes: 0 additions & 4 deletions packages/edit-site/src/components/page-pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ import { unlock } from '../../lock-unlock';
const { useLocation, useHistory } = unlock( routerPrivateApis );

const EMPTY_ARRAY = [];
const SUPPORTED_LAYOUTS = window?.__experimentalAdminViews
? [ LAYOUT_GRID, LAYOUT_TABLE, LAYOUT_LIST ]
: [ LAYOUT_GRID, LAYOUT_TABLE ];

function useView( postType ) {
const { params } = useLocation();
Expand Down Expand Up @@ -429,7 +426,6 @@ export default function PagePages() {
view={ view }
onChangeView={ onChangeView }
onSelectionChange={ onSelectionChange }
supportedLayouts={ SUPPORTED_LAYOUTS }
/>
</Page>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ const { useHistory, useLocation } = unlock( routerPrivateApis );

const EMPTY_ARRAY = [];

const SUPPORTED_LAYOUTS = window?.__experimentalAdminViews
? [ LAYOUT_TABLE, LAYOUT_GRID, LAYOUT_LIST ]
: [ LAYOUT_TABLE, LAYOUT_GRID ];

const defaultConfigPerViewType = {
[ LAYOUT_TABLE ]: {
primaryField: 'title',
Expand Down Expand Up @@ -209,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 Expand Up @@ -473,7 +467,6 @@ export default function PageTemplatesTemplateParts( { postType } ) {
onChangeView={ onChangeView }
onSelectionChange={ onSelectionChange }
deferredRendering={ ! view.hiddenFields?.includes( 'preview' ) }
supportedLayouts={ SUPPORTED_LAYOUTS }
/>
</Page>
);
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
Loading