From d19a55b22c42f0feb8cf77ac65065af60c9fc273 Mon Sep 17 00:00:00 2001 From: northeast18 Date: Sun, 14 Dec 2025 14:46:24 +0800 Subject: [PATCH 01/11] Add auto-deploy workflow to Cloudflare --- .github/workflows/auto-deploy.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/workflows/auto-deploy.yml diff --git a/.github/workflows/auto-deploy.yml b/.github/workflows/auto-deploy.yml new file mode 100644 index 00000000000..cccd93cb895 --- /dev/null +++ b/.github/workflows/auto-deploy.yml @@ -0,0 +1,14 @@ +name: Auto Deploy to Cloudflare + +on: + schedule: + # 每天北京时间凌晨 4 点 (UTC 20:00) 执行一次,你可以自己改 + - cron: '0 20 * * *' + workflow_dispatch: # 允许你在 GitHub 界面手动点击按钮触发 + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Trigger Cloudflare Deploy + run: curl -X POST "${{ secrets.CF_DEPLOY_HOOK }}" From bda4269218513b503d2a3e14ff44707ff9e0a0a3 Mon Sep 17 00:00:00 2001 From: northeast18 Date: Sun, 14 Dec 2025 14:54:15 +0800 Subject: [PATCH 02/11] Refactor auto-deploy workflow for Cloudflare Updated the workflow to include a trigger-deploy job and added comments for clarity. --- .github/workflows/auto-deploy.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/auto-deploy.yml b/.github/workflows/auto-deploy.yml index cccd93cb895..073452ea7b2 100644 --- a/.github/workflows/auto-deploy.yml +++ b/.github/workflows/auto-deploy.yml @@ -2,13 +2,15 @@ name: Auto Deploy to Cloudflare on: schedule: - # 每天北京时间凌晨 4 点 (UTC 20:00) 执行一次,你可以自己改 + # 每天北京时间凌晨 4 点 (UTC 20:00) 执行一次 - cron: '0 20 * * *' - workflow_dispatch: # 允许你在 GitHub 界面手动点击按钮触发 + workflow_dispatch: # 允许手动点击按钮触发 jobs: - build: + trigger-deploy: runs-on: ubuntu-latest steps: - - name: Trigger Cloudflare Deploy + - name: Trigger Cloudflare Deploy Hook + # 注意:这里引用的是 secrets.CF_DEPLOY_HOOK + # 请确保你在仓库 Settings -> Secrets and variables -> Actions 里已经添加了这个密钥 run: curl -X POST "${{ secrets.CF_DEPLOY_HOOK }}" From da4039317782cacb939f1681f8edebd76b584a12 Mon Sep 17 00:00:00 2001 From: northeast18 Date: Sun, 8 Feb 2026 17:24:18 +0800 Subject: [PATCH 03/11] fix: prevent uuidToId error when tocItem.id is undefined - Add defensive check in getPageTableOfContents to skip invalid blockId - Fix transclusion_reference handling to check if pointer exists - Add null check in all theme Catalog/Toc components before calling uuidToId This fixes the build error: TypeError: Cannot read properties of undefined (reading 'replaceAll') at uuidToId (notion-utils/build/index.js:533:31) --- lib/db/notion/getPageTableOfContents.js | 16 +++++++++++----- themes/commerce/components/Catalog.js | 3 +++ themes/example/components/Catalog.js | 3 +++ themes/fukasawa/components/Catalog.js | 5 ++++- themes/gitbook/components/Catalog.js | 3 +++ themes/heo/components/Catalog.js | 3 +++ themes/hexo/components/Catalog.js | 3 +++ themes/magzine/components/Catalog.js | 3 +++ themes/matery/components/Catalog.js | 3 +++ themes/medium/components/Catalog.js | 3 +++ themes/nav/components/Catalog.js | 3 +++ themes/next/components/Toc.js | 4 ++++ themes/nobelium/components/Catalog.js | 5 ++++- themes/simple/components/Catalog.js | 3 +++ themes/typography/components/Catalog.js | 3 +++ 15 files changed, 56 insertions(+), 7 deletions(-) diff --git a/lib/db/notion/getPageTableOfContents.js b/lib/db/notion/getPageTableOfContents.js index 738c22031cf..b23228f42fa 100644 --- a/lib/db/notion/getPageTableOfContents.js +++ b/lib/db/notion/getPageTableOfContents.js @@ -64,6 +64,9 @@ function getBlockHeader(contents, recordMap, toc) { } for (const blockId of contents) { + if (!blockId) { + continue // 跳过无效的 blockId + } const block = recordMap.block[blockId]?.value if (!block) { continue @@ -83,11 +86,14 @@ function getBlockHeader(contents, recordMap, toc) { }) } } else if (type === 'transclusion_reference') { - getBlockHeader( - [block.format.transclusion_reference_pointer.id], - recordMap, - toc - ) + const transclusionId = block.format?.transclusion_reference_pointer?.id + if (transclusionId) { + getBlockHeader( + [transclusionId], + recordMap, + toc + ) + } } else if (type === 'transclusion_container') { getBlockHeader(block.content, recordMap, toc) } diff --git a/themes/commerce/components/Catalog.js b/themes/commerce/components/Catalog.js index 1608f5fcb53..83f0e44f72d 100644 --- a/themes/commerce/components/Catalog.js +++ b/themes/commerce/components/Catalog.js @@ -77,6 +77,9 @@ const Catalog = ({ toc }) => { ref={tRef}>