fix(web): stop writing choice-card visibility into a ref during render
Independent Staging Quality Gate / validate (push) Successful in 11m56s
Independent Staging Quality Gate / publish (push) Successful in 17m31s

Staging lint failed on react-hooks/refs after the jump overlay fix.
Keep the latest card-open flag in the existing layout effect so ESLint
passes and the overlay still stays off the choice card.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jesse_Chen
2026-08-25 21:26:26 +08:00
co-authored by Cursor
parent f5e73ef326
commit 69ebbb9917
3 changed files with 22 additions and 1 deletions
@@ -983,8 +983,8 @@ export function RectificationAgenticChat(props: RectificationAgenticChatProps) {
&& !readonly
&& regeneratingMessageKey === null,
);
choiceCardsOpen.current = showChoiceCards;
useLayoutEffect(() => {
choiceCardsOpen.current = showChoiceCards;
updateFollowState();
}, [showChoiceCards, updateFollowState]);
const showSelectionCards = Boolean(
@@ -278,6 +278,11 @@ test("Agentic rectification follows the conversation tail only while the reader
assert.match(chat, /top: viewport\.scrollHeight/);
assert.match(chat, /shouldShowJumpToLatest/);
assert.match(chat, /choiceCardsOpen/);
assert.match(
chat,
/useLayoutEffect\(\(\) => \{\s*choiceCardsOpen\.current = showChoiceCards;\s*updateFollowState\(\);\s*\}, \[showChoiceCards, updateFollowState\]\)/,
);
assert.doesNotMatch(chat, /choiceCardsOpen\.current = showChoiceCards;\s*useLayoutEffect/);
assert.match(chat, /updateFollowState/);
assert.match(chat, /\}, \[busy, candidateResult, choiceCard, error, messages, savedTime, followLatestContent\]\);/);
assert.match(styles, /\.rectification-jump-latest \{[\s\S]*justify-content: flex-end/);