性能优化: 首页笔记本列表单次API获取 (Vibe Kanban) #12
Merged
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.
概述
优化首页笔记本列表加载性能,将 API 请求从 1 + 2N 个减少到 1 个(N 为笔记本数量)。
问题背景
原有实现中,首页加载笔记本列表时:
这导致如果有 10 个笔记本,首页加载需要 21 个 API 请求,严重影响加载性能。
实施的改动
后端
新增类型定义 (backend/types.go:46-56)
新增数据库方法 (backend/store.go:250-290)
新增 API 端点 (backend/server.go:109, 212-220)
前端
修改数据获取 (backend/frontend/static/app.js:382)
优化渲染逻辑 (backend/frontend/static/app.js:428-430)
删除冗余代码
性能提升
实现细节
This PR was written using Vibe Kanban