fix(notion): 从渲染上下文读取 Gallery 视图配置 - #4370
Merged
tangly1024 merged 1 commit intoAug 6, 2026
Merged
Conversation
|
@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. |
✅ Deploy Preview for notionnext-netlify ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
tangly1024
approved these changes
Aug 6, 2026
tangly1024
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed the narrow Gallery renderer-context fix and verified the targeted Jest test locally: yarn test tests/components/NotionCollectionGallery.test.js --runInBand.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
#4338 已补齐 Gallery 页面图标和 Title 可见性规则,但报告者在合并后的最新
main上复测仍无变化。重新沿真实渲染路径检查后发现,#4343 将第三方补丁迁移为本地
NotionCollection包装器时,包装器读取了props.collectionView;而react-notion-x@7.10.0的 Collection override 实际只传入block和ctx。因此可见性 helper 虽然测试通过,运行时却始终拿不到 Gallery 视图配置,也不会输出隐藏 class。这是 #4334 / #4338 的后续修复。
解决方案
block.view_ids[0]确定初始 Collection view;ctx.recordMap.collection_view读取并解包实际 Gallery view;galleryVisibilityClassName和 Gallery 限定样式;patch-package,保留 docs: remove dead update guide link #4343 避免修改第三方构建产物的目标。回归测试
新增两层契约检查:
NotionRenderer确认 Collection override 收到的是block与ctx,并确认 Gallery view 位于ctx.recordMap;原有当前数据与旧数据兼容用例继续保留。
风险与兼容性
验证
yarn jest __tests__/components/NotionCollectionGallery.test.js --runInBand(6/6)yarn test --runInBand(39 suites / 211 tests)yarn type-checkyarn lint(退出码 0;仅仓库既有 warnings)yarn build(61 个静态页面生成完成;仅仓库既有 warnings)yarn prettier --check components/NotionCollection.js __tests__/components/NotionCollectionGallery.test.jsgit diff --check用户文档