perf(题目列表): 切知识点、翻页有点卡——类型标签每个都让整页重算一遍样式,人数统计要扫整张提交索引
Deploy / deploy (push) Canceled after 0s

- 「画流程图 / 语法要求 / 有参考图」标签不再各自调 useDark():vueuse 每个实例都会重写
  <html> 的 class、插一段禁用过渡的样式再强制整页重算,一页十几个标签就重算十几遍。
  明暗两套色改走 CSS(html.dark)。每次切换 Vue 更新 46ms → 15ms、样式重算 24ms → 1.6ms
- 新索引 submission_public_problem_user_idx(problem_id, user_id, result,只含公开提交):
  每页「做对 / 做过人数」原来要把以 user_id 打头的索引 11 万行扫一遍。
  列表接口 19ms → 9ms,「最多人做对」排序 55ms → 26ms
- 第一次打开、没带筛选时,不再单独多数一次题目总数

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-10-09 12:52:38 +08:00
1 parent ed7752afbb
commit 74af88046e
6 files changed
+4196 -21

No files matched your search

+2 -1
View File
@@ -110,7 +110,9 @@ async function listProblems() {
total.value = res.total
problems.value = res.results
loaded.value = true
// 左栏「全部题目」的题数:没筛的时候这一页的 total 就是;带着筛选进来的才单独数一次
if (!query.tag && !hasExtraFilter.value && !undoneOn.value) allCount.value = res.total
else if (!allCount.value) allCount.value = (await getProblemList(0, 1, {})).total
}
async function loadSide() {
@@ -120,7 +122,6 @@ async function loadSide() {
])
tags.value = tagRes
progress.value = progressRes
if (!allCount.value) allCount.value = (await getProblemList(0, 1, {})).total
}
watchDebounced(() => query.keyword, listProblems, { debounce: 500, maxWait: 1000 })