Skip to content

perf: 全主题性能基线、运行时修复与低风险优化#3981

Merged
tangly1024 merged 9 commits into
mainfrom
chore/perf-audit-issues-baseline
May 1, 2026
Merged

perf: 全主题性能基线、运行时修复与低风险优化#3981
tangly1024 merged 9 commits into
mainfrom
chore/perf-audit-issues-baseline

Conversation

@tangly1024

@tangly1024 tangly1024 commented May 1, 2026

Copy link
Copy Markdown
Collaborator

背景

本 PR 聚焦“先发现问题 + 建立全主题性能基线 + 修复运行时回归”,为后续分阶段性能优化提供可执行标准。

本次改动(完整)

1. 性能审计与基线落库

  • 新增全主题审计脚本:scripts/audit-theme-performance.js
  • 新增命令:yarn perf:audit:themes
  • 在生产模式(yarn build && yarn start)下重跑并提交最新结果:
    • docs/performance/theme-audit-latest.md
    • docs/performance/theme-audit-latest.json

2. 开发规范与文档

  • DEVELOPMENT.md 增加“新主题性能准入(必做)”流程
  • DEVELOPMENT.md 新增 package.json 全量脚本用途说明(逐条解释)
  • package.json 版本号提升:4.9.5.1 -> 4.9.5.2
  • 新增中文贡献入口文档:CONTRIBUTING.zh-CN.md
  • 更新中英文 README 的开发者导航,补齐双语文档入口:
    • 文档导航入口(中文)
    • Docs Navigation (English)
    • 主题迁移指南(中文)
    • Theme Migration Guide (English)
    • 贡献入口(中文)
    • 贡献入口(英文)

3. 低风险性能优化

  • 构建/运行时热路径优化(next config、缓存判定、首页预览并发/数量控制等)
  • 主题动态布局 loader 缓存与路由行为优化
  • CPU 降载(收敛 observer 范围、conditional Prism/Notion processing)
  • 前端资源瘦身(分享功能轻量化、主题预览图 WebP 流程)

4. 运行时稳定性修复

  • 修复 Invalid hook call(普通函数中不再调用 Hook)
  • 修复参数透传导致的无效 DOM props 警告
  • 修复菜单 key 警告与 defaultProps 弃用警告
  • Mermaid 与深色模式样式一致性修复

验证

  • yarn lint(分文件针对性验证)
  • yarn type-check
  • yarn build
  • yarn start
  • yarn perf:audit:themes(生产模式)

说明

本 PR 主要完成“问题发现、基线建立、低风险改进、规范落地”;下一阶段将基于基线结果对低分主题(如 gitbook/fukasawa/fuwari/commerce/hexo)进行定向 LCP/CLS/TBT 优化。

tanglyqq added 7 commits May 1, 2026 19:52
Add clear server/runtime theme source logs and normalize query theme resolution so developers can see why final theme comes from query, Notion config, or local config.
Optimize build and runtime fundamentals by removing costly webpack overrides, reducing cache/data-path overhead, and adding baseline measurement tooling so performance regressions are easier to detect.
Drop heavy react-share usage in favor of lightweight share links, add preview-image webp generation with png fallback, and align image components to reduce client payload and improve first load.
Preserve internal link query state for theme previews, remove invalid hook usage from site config access, and harden mermaid plus dark-mode content styles to prevent freezes and improve visual consistency.
Lower client CPU overhead by scoping observers to article content, lazily initializing zoom handling, and skipping Prism/Mermaid work when pages do not contain code blocks.
Resolve key/default-props/link-prop runtime warnings and add a reusable theme performance audit script so theme-level regressions can be scanned consistently.
Run a full theme performance scan in production mode, commit the latest audit reports, and document mandatory theme audit checks so future theme work follows a consistent performance gate.
@vercel

vercel Bot commented May 1, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
notion-next-home Ready Ready Preview, Comment May 1, 2026 2:53pm
notion-next-preview Ready Ready Preview, Comment May 1, 2026 2:53pm
@tangly1024 tangly1024 changed the title perf: baseline audit and runtime stability fixes May 1, 2026
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying notionnext-blog with  Cloudflare Pages  Cloudflare Pages

Latest commit: e513b30
Status: ✅  Deploy successful!
Preview URL: https://55e7a4cf.notionnext-db5.pages.dev
Branch Preview URL: https://chore-perf-audit-issues-base.notionnext-db5.pages.dev

View logs

Bump project patch version and add a complete package.json script reference in the developer guide so contributors can understand and run each workflow command consistently.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying notionnext-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: e513b30
Status: ✅  Deploy successful!
Preview URL: https://74277595.notionnext-docs.pages.dev
Branch Preview URL: https://chore-perf-audit-issues-base.notionnext-docs.pages.dev

View logs

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 1, 2026

Copy link
Copy Markdown

Deploying notionnext-seo-lesson with  Cloudflare Pages  Cloudflare Pages

Latest commit: 25001a6
Status:⚡️  Build in progress...

View logs

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying notionnext-movie with  Cloudflare Pages  Cloudflare Pages

Latest commit: e513b30
Status: ✅  Deploy successful!
Preview URL: https://62459350.notionnext-movie.pages.dev
Branch Preview URL: https://chore-perf-audit-issues-base.notionnext-movie.pages.dev

View logs

Add a Chinese contribution guide and update both CN/EN README navigation sections so contributor onboarding docs are fully bilingual and consistently linked.
@tangly1024 tangly1024 self-assigned this May 1, 2026
@tangly1024 tangly1024 merged commit 6b3fd30 into main May 1, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants