fix(web): portal the natal board peek without effect setState

Quality gate lint failed on setHeaderSlot inside useLayoutEffect, so staging never published. Pass the header mount node from a callback ref instead.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jesse_Chen
2026-08-21 11:03:57 +08:00
co-authored by Cursor
parent 6757ad405d
commit f4619df273
5 changed files with 27 additions and 8 deletions
+3 -1
View File
@@ -1074,6 +1074,7 @@ export default function Home() {
);
const [rectificationSessionId, setRectificationSessionId] = useState<string | null>(null);
const [rectificationCaseId, setRectificationCaseId] = useState<string | null>(null);
const [rectificationHeaderSlot, setRectificationHeaderSlot] = useState<HTMLElement | null>(null);
const [rectificationPendingQuestion, setRectificationPendingQuestion] = useState<string | null>(null);
const [rectificationLoading, setRectificationLoading] = useState(false);
const [rectificationMutationPending, setRectificationMutationPending] = useState(false);
@@ -3566,7 +3567,7 @@ export default function Home() {
<strong>{activeSession?.title || "新对话"}</strong>
</div>
<div className="chat-header-actions">
<div className="chat-header-rectification" data-rectification-header-slot="" />
<div className="chat-header-rectification" data-rectification-header-slot="" ref={setRectificationHeaderSlot} />
<button className="credit-button" type="button" onClick={() => router.push(membershipHref("credits"))} aria-label={account ? `余额 ${account.credits} 点,会员与充值` : accountError || "读取余额中"}>
<Sparkles className="credit-icon" aria-hidden="true" />
<span>{account ? account.credits : "—"}</span>
@@ -3806,6 +3807,7 @@ export default function Home() {
onStartConsultation={() => void startConsultationAfterRectification()}
pendingConsultationQuestion={rectificationPendingQuestion}
onRestart={() => void startNewRectification()}
headerSlot={rectificationHeaderSlot}
/>
)}