fix(web): stop writing choice-card visibility into a ref during render
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:
@@ -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/);
|
||||
|
||||
Reference in New Issue
Block a user