Skip to content

fix(notion): 修复 Invisible 页面菜单映射 - #4372

Open
kforris wants to merge 2 commits into
notionnext-org:mainfrom
kforris:codex/fix-invisible-menu-routing
Open

fix(notion): 修复 Invisible 页面菜单映射#4372
kforris wants to merge 2 commits into
notionnext-org:mainfrom
kforris:codex/fix-invisible-menu-routing

Conversation

@kforris

@kforris kforris commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

问题

#4344 已支持 Menu/SubMenu 的源 slug 映射到 Page 的最终 href,但 getCustomMenu 只把 Published Page 视为可路由目标。

#4336 的报告者现已确认,受影响的 pendingcontactcopyright Page 都是 Invisible;Page 的完整路径可以直接访问,临时改为 Published 后菜单也立即恢复。这与本地失败用例一致:菜单仍保留 /pending,而没有替换为映射后的完整 Page href。

修复

  • PublishedInvisible Page 都视为可以被显式 Menu/SubMenu 引用的直接路由目标;
  • 保留现有唯一源 slug 匹配规则;
  • 继续排除 Draft,避免未发布页面被菜单意外暴露;
  • 外部链接、未匹配链接和重复 slug 的歧义行为不变。

验证

  • yarn test __tests__/lib/db/SiteDataApi.customMenu.test.js --runInBand:5/5 通过;
  • yarn test --runInBand:39 suites / 211 tests 通过;
  • yarn type-check:通过;
  • yarn lint:通过,仅仓库既有 warnings;
  • changed-file Prettier 与 git diff --check:通过;
  • GitHub CI 的 unit tests、lint/type-check、lockfile、VitePress 均通过,CodeQL 通过;
  • yarn build:候选分支和干净的 main@e401c019 均在编译、类型检查通过后,被仓库默认 Notion 数据源的 loadPageChunk 403 阻断,并在 /auth/result 预渲染阶段退出;已确认不是本次两文件改动引入。
  • Docker CI 也复现了相同的默认 Notion 数据源 403 与后续预渲染失败;Vercel 预览和自动 label 的失败分别是 fork 授权、写权限限制。

Follow-up to #4336 and #4344.

@kforris
kforris requested a review from tangly1024 as a code owner August 4, 2026 21:34
@netlify

netlify Bot commented Aug 4, 2026

Copy link
Copy Markdown

Deploy Preview for notionnext-netlify ready!

Name Link
🔨 Latest commit bb8eed5
🔍 Latest deploy log https://app.netlify.com/projects/notionnext-netlify/deploys/6a7404f9780d1a0007649813
😎 Deploy Preview https://deploy-preview-4372--notionnext-netlify.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@vercel

vercel Bot commented Aug 4, 2026

Copy link
Copy Markdown

@kforris is attempting to deploy a commit to the tangly1024's projects Team on Vercel.

A member of the Team first needs to authorize it.

@vercel

vercel Bot commented Aug 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
notion-next-preview Ready Ready Preview Aug 6, 2026 3:57am

@tangly1024

Copy link
Copy Markdown
Collaborator

我这边做了合并前复核:

  • 代码差异很窄,只把 Invisible 页面纳入菜单 slug -> generated href 映射,同时保留 Draft 不暴露的保护。
  • 本地隔离 worktree 里已通过目标测试:yarn test __tests__/lib/db/SiteDataApi.customMenu.test.js --runInBand,5 tests passed。
  • 但我重跑了 Docker 构建,仍然失败;日志里失败点不是这次菜单映射代码,而是构建示例 Notion 页面时 https://www.notion.so/api/v3/loadPageChunk 返回 403 Forbidden,随后 allPages/categoryOptions 为空导致 /zh-CN/404 prerender 序列化失败。
  • Netlify 预览也是同一轮外部构建失败状态,Vercel 是 green。

结论:代码本身看起来可以,但当前 PR 仍有 Docker/Netlify 红灯。我先不强合并,等外部 Notion 数据/预览构建恢复后再 rerun;如果 Docker/Netlify 转绿,这个 PR 可以按当前实现合入。

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.

2 participants