fix: use stable unique chat page keys

This commit is contained in:
2026-05-13 09:57:27 +08:00
parent bde57392eb
commit 7ac68960b4
+24 -24
View File
@@ -1208,8 +1208,8 @@ export default function ChatPage() {
: "输入问题、查看流式回答和引用来源,历史会话会自动沉淀。"}
</Text>
<div className="review-page-highlight-list">
{chatHighlights.map((item) => (
<span className="review-page-highlight-chip" key={item}>
{chatHighlights.map((item, index) => (
<span className="review-page-highlight-chip" key={`highlight-${index}-${item}`}>
{item}
</span>
))}
@@ -1221,8 +1221,8 @@ export default function ChatPage() {
{reviewContext ? "上下文已就绪" : "问答节奏"}
</Title>
<ul className="review-page-tip-list">
{chatTips.map((item) => (
<li key={item}>{item}</li>
{chatTips.map((item, index) => (
<li key={`tip-${index}-${item}`}>{item}</li>
))}
</ul>
<Text type="secondary" style={{ display: "block", marginTop: 12 }}>
@@ -1241,16 +1241,16 @@ export default function ChatPage() {
{focusPanelDescription ? <Text type="secondary">{focusPanelDescription}</Text> : null}
</div>
<div className="chat-followup-focus-items">
{focusPanelItems.map((item) => (
<div className="chat-followup-focus-item" key={item}>{item}</div>
{focusPanelItems.map((item, index) => (
<div className="chat-followup-focus-item" key={`focus-${index}-${item}`}>{item}</div>
))}
</div>
</div>
) : null}
{contextCards.length ? (
<div className="chat-review-meta-grid" style={{ marginTop: 16 }}>
{contextCards.map((item) => (
<div className="chat-review-meta-card" key={item.label}>
{contextCards.map((item, index) => (
<div className="chat-review-meta-card" key={`context-${index}-${item.label}`}>
<span>{item.label}</span>
<strong>{item.value}</strong>
</div>
@@ -1319,10 +1319,10 @@ export default function ChatPage() {
<Text type="secondary">发送快捷键:Ctrl/⌘ + Enter</Text>
{followupSuggestions.length ? (
<div className="chat-review-grid">
{followupSuggestions.map((item) => (
{followupSuggestions.map((item, index) => (
<button
className={item.tone === "primary" ? "chat-history-item chat-followup-card chat-followup-card-primary" : "chat-history-item chat-followup-card"}
key={item.label}
key={`followup-${index}-${item.label}`}
onClick={() => void submitQuestion(item.prompt)}
type="button"
>
@@ -1365,8 +1365,8 @@ export default function ChatPage() {
<p>{conclusionSection?.items.join(" ") || latestAssistantMessage?.content || "暂无审查结论"}</p>
</div>
<div className="chat-review-meta-grid">
{reviewOverviewItems.map((item) => (
<div className="chat-review-meta-card" key={item.label}>
{reviewOverviewItems.map((item, index) => (
<div className="chat-review-meta-card" key={`overview-${index}-${item.label}`}>
<span>{item.label}</span>
<strong>{item.value}</strong>
</div>
@@ -1381,8 +1381,8 @@ export default function ChatPage() {
<strong>{summarySection.title}</strong>
</div>
<ul className="chat-review-list">
{summarySection.items.map((item) => (
<li key={item}>{item}</li>
{summarySection.items.map((item, index) => (
<li key={`summary-${index}-${item}`}>{item}</li>
))}
</ul>
</section>
@@ -1395,8 +1395,8 @@ export default function ChatPage() {
<strong>{checklistSection.title}</strong>
</div>
<ul className="chat-review-list">
{checklistSection.items.map((item) => (
<li key={item}>{item}</li>
{checklistSection.items.map((item, index) => (
<li key={`checklist-${index}-${item}`}>{item}</li>
))}
</ul>
</section>
@@ -1411,8 +1411,8 @@ export default function ChatPage() {
</div>
{reviewActionCards.length ? (
<div className="chat-action-card-grid">
{reviewActionCards.map((item) => (
<article className="chat-action-card" key={`${item.title}-${item.href}`}>
{reviewActionCards.map((item, index) => (
<article className="chat-action-card" key={`action-${index}-${item.title}-${item.href}`}>
<strong>{buildActionCardTitle(item)}</strong>
<p>{buildActionCardDescription(item)}</p>
<Link className="landing-primary-action chat-action-card-link" href={buildActionCardHref(item)}>
@@ -1429,15 +1429,15 @@ export default function ChatPage() {
{otherSections.length ? (
<div className="chat-review-grid">
{otherSections.map((section) => (
<section className="chat-review-section chat-review-section-soft" key={section.title}>
{otherSections.map((section, sectionIndex) => (
<section className="chat-review-section chat-review-section-soft" key={`section-${sectionIndex}-${section.title}`}>
<div className="chat-review-section-header">
<span className="landing-card-eyebrow">Section</span>
<strong>{section.title}</strong>
</div>
<ul className="chat-review-list">
{section.items.map((item) => (
<li key={item}>{item}</li>
{section.items.map((item, itemIndex) => (
<li key={`section-${sectionIndex}-item-${itemIndex}-${item}`}>{item}</li>
))}
</ul>
</section>
@@ -1496,10 +1496,10 @@ export default function ChatPage() {
<Space direction="vertical" size="middle" style={{ width: "100%" }}>
<Text type={sourceStateTone}>{sourcePanelMeta.panel.description}</Text>
<Text type="secondary">{sourceStatusText}</Text>
{sourcePanelMeta.items.map((item) => {
{sourcePanelMeta.items.map((item, index) => {
const badge = buildBadgeState(item, reviewContext);
return (
<div className="chat-source-card" key={`${item.title}-${item.content}`}>
<div className="chat-source-card" key={`source-${index}-${item.title}-${item.content}`}>
<div className="chat-source-title">
<MessageOutlined />
<strong>{item.title}</strong>