mobile: 首页 home presentation 派生视图模型下沉 store 层(增量维护 + 引用调和)
- Dominant language
- TypeScript
- Stars
- 2.7k
- Forks
- 395
- Avg merge
- 21h 48m
- Merged PRs (30d)
- 776
Description
## 背景
风暴修复链(e576b07ef / fc98be23b,详见 makecindy/cindy#59 背景)中确认:首页/设备详情页各自用一条长 useMemo 链(messagePreviewIndex / pendingInteractionIndex / liveActivityIndex → buildMobileHomePresentation → buildHomeSections)在**屏幕层**拼装视图模型,依赖曾挂在全局 storeVersion/messageVersion 上——谁接错 deps 谁风暴。当前用 useStableValue 内容稳定化兜住,但派生逻辑仍散在两个 2000+ 行的屏幕文件里,每个屏幕自拼一份。
## 提案
把 home presentation(索引、sections)下沉到 store 层增量维护:store 内在写入点局部更新受影响的派生条目并做引用调和,屏幕只订阅最终结果(天然享受分片订阅 makecindy/cindy#59)。屏幕文件回归纯渲染。
## 验收
- 与 makecindy/cindy#59 相同的三层标尺(CI 不变量 / render-trace 前后对比 / js-stall 金丝雀);
- 首页与设备详情页的派生 useMemo 链移除后,homeDesktopFirst 契约测试仍全绿(保鲜语义不回归:运行态、相对时间、折叠豁免、未读徽标)。
Contributor guide
Research direction
Start by tracing messagePreviewIndex, pendingInteractionIndex, liveActivityIndex, buildMobileHomePresentation, and buildHomeSections through the home and device-detail screens. Read the homeDesktopFirst contract tests and compare the CI invariants, render-trace, and js-stall criteria before changing ownership. Done means the screen useMemo chains are removed and all freshness, runtime, relative-time, collapse-exemption, and unread-badge checks remain green.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react-native, typescript
- Domain
- frontend, mobile
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100