makecindy / makecindy/cindy

bug: iOS 长助手消息滚动时明显卡顿

Open
#1,057 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
2.7k
Forks
395
Avg merge
21h 48m
Merged PRs (30d)
776

Description

**提交人**: 匿名
**客户端版本**: 0.0.0

---

## 现象

在 Cindy CN 的 iOS 客户端中,打开包含较长助手回复的会话后,上下滚动消息正文会出现明显掉帧和卡顿。短消息及普通会话滚动基本正常。复现设备为实体 iPhone;当前未记录具体机型、iOS 版本和已安装客户端版本。

## 复现步骤

1. 在 iPhone 上登录 Cindy CN,并连接桌面会话。
2. 打开一段包含较长、已完成助手回复的对话(正文跨越多个屏幕,包含 Markdown 或连续文本)。
3. 在该回复区域反复上下滚动。
4. 对比短消息区域,可以观察到明显掉帧和滚动卡顿。

## 期望行为

长消息应保持接近原生列表的流畅滚动,同时保留完整 Markdown 展示、整条消息复制,以及短消息的细粒度文本选择能力。

## 实际行为

滚动经过长助手消息时明显卡顿,消息越长越容易出现。

## 初步定位

基于源码提交 53db0b68 排查:

- 移动端消息历史使用 LegendList,但列表只能按消息行虚拟化,无法虚拟化单条消息内部内容。
- MarkdownBody 会把连续文本合并为 text_run。
- iOS 上已完成且可选择的文本由 react-native-uitextview 渲染,因此长助手回复可能形成一个非常高的 UITextView。
- TextKit 对超高 UITextView 的布局和绘制可能成为滚动卡顿的主要来源。
- 现有 allowIosUITextView={!shouldCollapseLongMessage} 回退只覆盖展开后的长用户消息;长助手消息不进入用户消息折叠测量,仍会使用 UITextView。

## 建议方案

为 iOS 已完成消息设置 UITextView 渲染预算。正文超过阈值时,复用现有 RN Text 回退;另一种方案是按块切分或虚拟化文本。长消息继续保留完整 Markdown 和整条复制,短消息仍使用 UITextView 做细粒度选择。

## 验证情况

本地试验补丁以 80 个估算可视行为阈值,已通过 mobile typecheck、92 个相关测试和全部 2527 个 mobile 测试;其中 3 个沙箱环境受限测试已在沙箱外单独复跑通过。
---
**版本区域**: CN
**OS**: darwin x64 (24.6.0)
**界面语言**: zh-CN

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the mobile message history around LegendList, MarkdownBody, react-native-uitextview, and allowIosUITextView, using commit 53db0b68 as context. Reproduce the long completed assistant-message scroll case, then compare the existing RN Text fallback with UITextView rendering. Done means long messages scroll smoothly while retaining Markdown, whole-message copying, and text selection for short messages; run mobile typecheck and the related tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, react-native, typescript
Domain
mobile, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.