Skip to content

v4.10.2

Choose a tag to compare

@tangly1024 tangly1024 released this 08 Jun 08:39
· 481 commits to main since this release

版本概览

v4.10.2 是一次面向构建效率、Notion 数据兼容性和评论登录体验的小版本发布。重点是让未更新过的 Notion 文章在后续构建中复用正文缓存,显著减少 Notion 页面正文重复拉取;同时修复 Giscus OAuth 回跳后仍提示登录的问题。

本版本已包含 Vercel 部署 type-check 修复:fetchNotionPageBlocks 的 from 参数类型已放宽为 string | undefined,避免 lib/site/adapters/notion/notion.fetcher.ts 在生产构建中报错。

本轮发布窗口也补充记录了 4.10.1 之后主线上的多项修复,包括嵌入式 collection view 过滤、sync_block 兼容、quote block 渲染、数据库视图筛选和 Fuwari 主题色相初始化等。

主要改动

构建性能:增量 Notion 正文缓存

  • 新增版本化 Notion 页面正文缓存:缓存键由 page_block_<pageId> 扩展为 page_block_<pageId>_<lastEditedTimestamp>。
  • 每次构建仍重新拉取 Notion 数据库索引,用于发现新文章、删除/隐藏文章、slug 变化和 last_edited_time 变化。
  • 如果文章 lastEditedDate 未变化,预热和页面渲染会直接命中上次构建缓存,不再重复请求 Notion 页面正文。
  • prefetchAllBlockMaps 改为优先读取版本化正文缓存,缓存命中时跳过 fetchNotionPageBlocks。
  • 单篇文章页、公告页和全文搜索统一使用版本化正文缓存,避免预热、渲染、搜索三处缓存键不一致。
  • 构建启动清理策略调整为保留版本化正文缓存,只清理数据库索引、静态路径、构建 session 等临时缓存。
  • 新增 NOTION_BUILD_CACHE_PURGE_DATA=true,当怀疑缓存损坏时可手动强制清空持久 Notion 数据缓存。

Vercel 构建修复

  • 修复 fetchNotionPageBlocks(pageId, from) 在 TypeScript 严格检查下把 from 推断成 null | undefined 的问题。
  • 修复 Vercel 构建时报错:Argument of type 'string | undefined' is not assignable to parameter of type 'null | undefined'。
  • 已通过 npm run type-check 验证。

Giscus 评论登录修复

  • 修复 Giscus OAuth 回跳后的 ?giscus=... token 被页面容器过早移除的问题。
  • 现在回跳 token 会先交给 Giscus 脚本消费并写入 localStorage,随后再清理地址栏参数。
  • 解决登录 GitHub 返回文章页后,评论框仍显示“登录后可以评论”的循环登录问题。

Notion 数据兼容性修复

  • 修复嵌入式 Notion collection view 数据未过滤导致页面数据膨胀、无关集合记录泄露到页面 props 的问题。
  • 修复 Notion 新结构中 sync_block 的 content ID 数组解析问题,避免同步块内容缺失。
  • 修复没有 properties.title 的 quote block 渲染异常,提升 Notion 块结构兼容性。
  • 修复数据库页面解析中视图筛选条件因短 ID / UUID 格式不一致而失效的问题。
  • 保留并强化 collection view 过滤相关回归测试,覆盖数据库视图筛选和嵌入集合场景。

主题修复

  • 修复 Fuwari 主题首次渲染时主题色相未立即应用的问题,避免初屏色彩与配置不一致。
  • 修复 Magzine 主题推荐标签默认值处理,避免未配置推荐标签时推荐逻辑异常。

文档同步

  • VitePress 文档的“最新版本”更新为 4.10.2。
  • 同步更新用户指南、参考手册和主题目录中的当前版本标注。
  • 最新版本页补充增量构建缓存的原理、适用场景和清缓存方式。
  • 补充 4.10.1 之后主线同期修复范围,方便站长判断升级收益。

使用建议

  • Cloudflare Pages 用户请确认 Build cache 已开启,这样 .next/cache 才能在下一次构建恢复并复用。
  • 正常情况下无需配置新变量。
  • 如需强制全量刷新 Notion 正文缓存,可临时设置:
NOTION_BUILD_CACHE_PURGE_DATA=true

重新部署一次后再移除该变量即可。

验证

  • npm run type-check 通过。
  • npx eslint lib\db\notion\getPostBlocks.js lib\site\adapters\notion\notion.fetcher.ts 通过。
  • npx eslint lib\db\notion\getPostBlocks.js lib\build\prefetch.js lib\db\SiteDataApi.js pages\search\[keyword]\index.js pages\search\[keyword]\page\[page].js next.config.js 通过。
  • node -e "require('./next.config.js')" 通过。
  • git diff --check 通过。
  • npm run docs:site:build 通过。

相关提交

  • 58fa0656 fix: preserve giscus oauth callback token
  • 10aae3ab release: 4.10.1 incremental notion build cache
  • 4ddf7eda release: 4.10.2
  • f93460fd fix: widen notion page block fetch source type
  • 9c793e3c fix: handle sync_block with content ID array
  • 782a35bf fix: render quote blocks without properties.title
  • 6b24adc9 fix: respect view-level filters in database page resolution
  • f837e3d9 fix: apply Fuwari theme hue on initial render
  • e48f44e2 fix: respect magzine recommend tag default