Skip to content

feat(thread-chat): 缓存并后台刷新会话列表 - #80

Merged
hifizz merged 2 commits into
mainfrom
perf-project-list-cache
Sep 3, 2026
Merged

feat(thread-chat): 缓存并后台刷新会话列表#80
hifizz merged 2 commits into
mainfrom
perf-project-list-cache

Conversation

@hifizz

@hifizz hifizz commented Sep 3, 2026

Copy link
Copy Markdown
Owner

改动

  • GET /api/thread-chat/v1/projects 固定返回列表 DTO:id、title、updatedAt、threadCount
  • 服务端用一次聚合查询生成列表,删除客户端逐个获取完整 Project bootstrap 的 N+1 请求
  • 在 thread-chat layout 下持有轻量 ProjectListStore,跨 Project 路由切换保留内存缓存
  • 页面进入时预取;弹窗打开时先展示缓存,再通过 Store action 后台刷新
  • 并发 refresh 返回同一个进行中的 Promise,不重复发起网络请求
  • 重命名和删除会使旧刷新失效,避免旧响应覆盖 mutation
  • 刷新期间显示低对比度 2px 流动细线,失败时保留已有缓存
  • AGENTS.md 禁止手动运行 Prettier 和 format,仅允许 git hook 调用

额外逻辑变化

  • 裸 /thread-chat 跳转改为复用 ProjectListStore,因此与 layout 预取共享请求
  • 列表标题由服务端按 customTitle、autoTitle、新对话的顺序生成,不再为了标题兜底下载消息
  • 删除成功后同步移除 Store 缓存;重命名继续乐观更新,失败时仅在标题未再次变化时回滚

验证

  • pnpm typecheck
  • ESLint:本次改动的 TypeScript/TSX 文件
  • node --import tsx --test e2e/thread-chat/project-list-store.test.mjs e2e/thread-chat/tree-list-row.test.mjs
  • pnpm test:thread-chat:gate2-api-db
  • ego-browser:验证入口请求合并、接口字段、无 N+1、缓存首帧和后台刷新线

@vercel

vercel Bot commented Sep 3, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
thread-chatbot Error Error Sep 3, 2026 5:52pm UTC

@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 48d7052d-5b22-42d8-93f7-dc6898633c97


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@hifizz
hifizz merged commit 34af47d into main Sep 3, 2026
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant