fix(mobile): keep a chat code block's wrap choice when its prose redraws (#42908)

MobileNativeChatMessage keyed each prose block by a running offset that its proseRow closure advanced. Paced prose calls that closure from its own renders (reveal steps, the scroll growth hold), so every such render continued from the last total and handed the code block a new row key, which dropped its wrap choice. Key the block by its index instead.
This commit is contained in:
Kelvin Amoaba
2026-11-16 01:52:24 +00:00
committed by GitHub
parent f9984c1d13
commit 69edf46ec8
@@ -247,10 +247,9 @@ function MobileNativeChatMessageImpl({
)
}
const isChatTurn = message.role === 'user' || message.role === 'assistant'
let proseOffset = 0
// Paced prose calls this from its own renders too, so the key must not depend on earlier calls.
const proseRow = (block: Chat.NativeChatBlock, key: number, text: string, revealing = false) => {
const textKey = `${message.id}:text:${proseOffset}`
proseOffset += text.length + 1
const textKey = `${message.id}:text:${key}`
return Chat.isSubagentGroupBlock(block) && isRenderableSubagentGroup(block) ? (
<MobileNativeChatSubagentGroup
key={`subagent-group:${block.groupId}`}