Skip to content

Commit 22b0910

Browse files
committed
Merge branch 'main' of github.com:Q42/sanity-plugin-page-tree
2 parents a1eabfa + a0dfe91 commit 22b0910

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,4 @@
146146
"eslintImports": false
147147
}
148148
}
149-
}
149+
}

src/components/PageTreeViewItem.tsx

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

src/helpers/page-tree.ts

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

9797
return getChildPages(parentId).map(page => {
9898
const pagePath = parentPath
99-
? `${parentPath === '/' ? '' : parentPath}/${page.slug?.current}`
99+
? `${parentPath === '/' ? '' : parentPath}/${page.slug?.current ?? ''}`
100100
: `/${getRootPageSlug(page, config) ?? ''}`;
101101
const children = orderBy(mapPageTreeItems(config, pagesWithPublishedState, page._id, pagePath), 'path');
102102

@@ -141,7 +141,7 @@ const getPublishedAndDraftRawPageMetadata = (
141141
};
142142

143143
const isValidPage = (config: PageTreeConfig, page: RawPageMetadata): boolean => {
144-
if (!page.parent || !page.slug) {
144+
if (!page.parent) {
145145
if (page._type !== config.rootSchemaType) {
146146
return false;
147147
}

0 commit comments

Comments
 (0)