Replace the per-item backward scan that located the most recent session anchor with a single forward pass via useMemo. Before: for every timeline item the render loop walked backward until it found a lead-thought anchor, so N items produced up to N * N anchor lookups on every render pass. After: a single O(n) sweep builds previousSessionAnchorByIndex; render time lookup is O(1). getItemSessionAnchorId is hoisted to module scope so it is not recreated per render. Behavior is unchanged. The three existing separator tests still pass, and four new cases cover three-session transitions, long runs of non-anchor items between thought groups, consecutive same-session thoughts, and single-item lists. |
||
|---|---|---|
| .. | ||
| cli | ||
| common | ||
| extensions | ||
| runtime | ||
| sidebar | ||
| team | ||
| fileLink.test.ts | ||
| renderOutput.test.ts | ||
| reviewDiffSafety.test.ts | ||