Skip to content

Commit 3a5d59c

Browse files
committed
Fix showing page tree items without slug and show untitled as fallback text
1 parent 7acb9dc commit 3a5d59c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/components/PageTreeViewItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export const PageTreeViewItem = ({
110110
onClick={onItemClick}>
111111
<Flex align="center" gap={3}>
112112
<UrlText isDisabled={isDisabled || (!page.isPublished && page.isDraft)} textOverflow="ellipsis">
113-
{parentPath ? page.slug?.current : getRootPageSlug(page, config) ?? '/'}
113+
{parentPath ? page.slug?.current ?? 'untitled' : getRootPageSlug(page, config) ?? '/'}
114114
</UrlText>
115115
{!isDisabled && (isHovered || hasActionOpen) && (
116116
<PageTreeViewItemActions

src/helpers/page-tree.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ const mapPageTreeItems = (
8989

9090
return getChildPages(parentId).map(page => {
9191
const pagePath = parentPath
92-
? `${parentPath === '/' ? '' : parentPath}/${page.slug?.current}`
92+
? `${parentPath === '/' ? '' : parentPath}/${page.slug?.current ?? ''}`
9393
: `/${getRootPageSlug(page, config) ?? ''}`;
9494
const children = orderBy(mapPageTreeItems(config, pagesWithPublishedState, page._id, pagePath), 'path');
9595

@@ -134,7 +134,7 @@ const getPublishedAndDraftRawPageMetadata = (
134134
};
135135

136136
const isValidPage = (config: PageTreeConfig, page: RawPageMetadata): boolean => {
137-
if (!page.parent || !page.slug) {
137+
if (!page.parent) {
138138
if (page._type !== config.rootSchemaType) {
139139
return false;
140140
}

0 commit comments

Comments
 (0)