Skip to content

fix(dashboard): 避免会话消息链接重复预取 - #1412

Merged
ding113 merged 1 commit into
ding113:devfrom
Syh1906:fix/dashboard-session-prefetch
Aug 12, 2026
Merged

fix(dashboard): 避免会话消息链接重复预取#1412
ding113 merged 1 commit into
ding113:devfrom
Syh1906:fix/dashboard-session-prefetch

Conversation

@Syh1906

@Syh1906 Syh1906 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

问题

错误详情弹窗会为带消息的会话记录渲染详情链接。Next.js Link 默认会在链接进入视口时预取目标页面,多条记录同时出现时,会在短时间内触发大量会话消息请求。

相关 Issue / PR:

修改

  • 关闭错误详情弹窗中会话消息详情链接的自动预取(prefetch={false})。
  • 保留用户点击后的正常跳转行为。
  • 补充回归测试,确保该链接不会再次启用自动预取。

变更范围

文件 说明
SummaryTab.tsx 为会话消息详情链接添加 prefetch={false}
error-details-dialog.test.tsx mock Link 透出 prefetch 属性,并断言该链接 data-prefetch="false"

无 schema / 迁移 / API / 导出签名变更,无破坏性改动。

验证

  • 聚焦回归测试:52/52 passed。
  • bun run lint:passed。
  • bun run typecheck:passed。
  • bun run build:passed。
  • git diff --check:passed。
  • 完整 bun run test 在未改动的 language-switcher.test.tsx 中有 1 个既有失败;单独运行该文件仍可复现。

Description enhanced by Claude AI

Greptile Summary

This PR disables automatic prefetching for session-message detail links in the dashboard error dialog while preserving click navigation.

  • Adds prefetch={false} to the locale-aware session-message link.
  • Extends the dialog regression test to verify that prefetching remains disabled.

Confidence Score: 5/5

The PR appears safe to merge with no actionable correctness or security issues identified.

The production change narrowly disables automatic prefetching on the intended locale-aware link, and the updated test exercises that specific session-message URL and verifies the disabled value.

Important Files Changed

Filename Overview
src/app/[locale]/dashboard/logs/_components/error-details-dialog/components/SummaryTab.tsx Disables automatic prefetching on the existing session-message detail link without changing its destination or visibility conditions.
src/app/[locale]/dashboard/logs/_components/error-details-dialog.test.tsx Updates the routing-link mock to expose the prefetch prop and adds a focused regression assertion for the changed link.

Reviews (1): Last reviewed commit: "fix(dashboard): disable session message ..." | Re-trigger Greptile

Co-Authored-By: GPT-5 <noreply@openai.com>
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

本次变更为会话消息详情链接设置 prefetch={false}。测试中的 Link mock 支持 prefetch 属性,并验证 Prefix Session 详情链接输出 data-prefetch="false"

Changes

会话消息详情链接预取

Layer / File(s) Summary
禁用详情链接预取并更新测试
src/app/[locale]/dashboard/logs/_components/error-details-dialog/components/SummaryTab.tsx, src/app/[locale]/dashboard/logs/_components/error-details-dialog.test.tsx
SummaryTabsessionMessagesHref 详情链接设置 prefetch={false}。测试 mock 输出 data-prefetch,并断言 Prefix Session 详情链接的值为 "false"

Estimated code review effort: 1 (简单) | ~5 分钟

Possibly related PRs

Suggested reviewers: ding113

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed 标题准确概括了禁用会话消息链接自动预取的主要修复内容。
Description check ✅ Passed 描述与变更内容一致,并说明了修改范围、验证结果和已知测试失败。
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai
coderabbitai Bot requested a review from ding113 August 11, 2026 06:54
@github-actions github-actions Bot added bug Something isn't working area:UI labels Aug 11, 2026
@Syh1906
Syh1906 marked this pull request as ready for review August 11, 2026 06:59
Copilot AI lite review requested due to automatic review settings August 11, 2026 06:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR mitigates a dashboard performance issue where the error details dialog could trigger many session-message page prefetched requests via Next.js Link auto-prefetch. It disables automatic prefetch for the session message detail link while keeping normal navigation on click, and adds a regression test to ensure prefetch stays disabled.

Changes:

  • Add prefetch={false} to the session message detail Link in the error details dialog summary tab.
  • Update the dialog test to mock Link with a visible prefetch attribute and assert the message-detail link sets it to "false".

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/app/[locale]/dashboard/logs/_components/error-details-dialog/components/SummaryTab.tsx Disables auto-prefetch for the session message detail link in the dialog.
src/app/[locale]/dashboard/logs/_components/error-details-dialog.test.tsx Extends the Link mock to expose prefetch and asserts the message-detail link disables it.
Suppressed comments (1)

src/app/[locale]/dashboard/logs/_components/error-details-dialog/components/SummaryTab.tsx:368

  • Link renders as an <a> and currently wraps a <Button> (which renders as a <button>), producing invalid nested interactive elements (<a><button>…</button></a>). This can cause accessibility / click/keyboard issues. Prefer styling the link as a button via Button asChild and render the Link as the child.
                    <Link href={sessionMessagesHref} prefetch={false}>
                      <Button variant="outline" size="sm">
                        <ExternalLink className="h-4 w-4 mr-2" />
                        {t("viewDetails")}
                      </Button>

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions github-actions Bot added the size/XS Extra Small PR (< 50 lines) label Aug 11, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

No significant issues identified in this PR.

PR Size: XS

  • Lines changed: 21 (18 additions, 3 deletions)
  • Files changed: 2

Review Coverage

  • Logic and correctness - Clean
  • Security (OWASP Top 10) - Clean
  • Error handling - Clean
  • Type safety - Clean
  • Documentation accuracy - Clean
  • Test coverage - Adequate
  • Code clarity - Good

Automated review by Claude AI

@ding113
ding113 merged commit c8a2e52 into ding113:dev Aug 12, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:UI bug Something isn't working size/XS Extra Small PR (< 50 lines)

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

3 participants