mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 08:02:28 +00:00
Both PR files viewers rebuilt the section-index Map with `useMemo(..., [sections])`. An on-demand section load replaces the sections array while the section keys stay identical, so every load handed the file tree a new Map identity — a memo miss for all ~900 `CombinedDiffFileTreeRow`s. `useCombinedDiffTreeNavigation` already cached the map behind an entry-signature + per-index key comparison. Extract that into `useCombinedDiffSectionIndexMap` and use it from all three call sites. The extracted hook seeds its cache from a `useLayoutEffect` rather than during render, so a render React discards cannot leave behind an entry describing sections that never committed.