fix(dashboard): 避免会话消息链接重复预取 - #1412
Conversation
Co-Authored-By: GPT-5 <noreply@openai.com>
📝 WalkthroughWalkthrough本次变更为会话消息详情链接设置 Changes会话消息详情链接预取
Estimated code review effort: 1 (简单) | ~5 分钟 Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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 detailLinkin the error details dialog summary tab. - Update the dialog test to mock
Linkwith a visibleprefetchattribute 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
Linkrenders 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 viaButton asChildand render theLinkas 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.
There was a problem hiding this comment.
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
问题
错误详情弹窗会为带消息的会话记录渲染详情链接。Next.js
Link默认会在链接进入视口时预取目标页面,多条记录同时出现时,会在短时间内触发大量会话消息请求。相关 Issue / PR:
修改
prefetch={false})。变更范围
SummaryTab.tsxprefetch={false}。error-details-dialog.test.tsxLink透出prefetch属性,并断言该链接data-prefetch="false"。无 schema / 迁移 / API / 导出签名变更,无破坏性改动。
验证
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.
prefetch={false}to the locale-aware session-message link.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
Reviews (1): Last reviewed commit: "fix(dashboard): disable session message ..." | Re-trigger Greptile