Skip to content

Fix the bug of traversing collections #658

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Euruson
Copy link

@Euruson Euruson commented Aug 5, 2025

Description

The getAllPagesInSpace() function in notion-utils is valuable for sitemap generation and SSG. However, the current implementation fails to retrieve subpages within collections. This is because it searches for blockIds inside CollectionQueryResult, where the results are typically not present.

Upon investigation, I found that the relevant subpage data primarily resides in CollectionQueryResult.collection_group_results, not in the main CollectionQueryResult itself.

Notion Test Page ID

You can verify this behavior by logging the results during the build process.

Copy link

vercel bot commented Aug 5, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
react-notion-x ✅ Ready (Inspect) Visit Preview Aug 9, 2025 4:15pm
react-notion-x-minimal-demo ✅ Ready (Inspect) Visit Preview Aug 9, 2025 4:15pm

@@ -34,7 +34,7 @@ export function getCollectionGroups(
}

// TODO: review dates format based on value.type ('week'|'month'|'year')
queryValue = format(new Date(queryLabel), 'MMM d, YYY hh:mm aa')
queryValue = format(new Date(queryLabel), 'MMM d, yyy hh:mm aa')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The date format pattern yyy will display only 3 digits for the year (e.g., "202" instead of "2023"). To correctly display a 4-digit year, the pattern should be yyyy. This same issue appears in multiple places throughout the PR and should be fixed in all occurrences.

Suggested change
queryValue = format(new Date(queryLabel), 'MMM d, yyy hh:mm aa')
queryValue = format(new Date(queryLabel), 'MMM d, yyyy hh:mm aa')

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant