[PR #13299] perf(app): collapse large diffs in review panel to prevent UI freeze #14605

Open
opened 2026-02-16 18:19:23 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/13299

State: open
Merged: No


Fixes #13297

What

Review panel freezes when files with large diffs (500+ lines) are auto-expanded.

Why

The existing logic only checks total file count to decide expand/collapse, ignoring individual diff size. A single 2000-line diff can lock up the UI.

How

  • Files with additions + deletions > 500 are collapsed by default
  • "Expand All" skips large files
  • Click-to-confirm: first click shows line count warning, second click within 3s expands
  • Auto-collapse large files when review panel unmounts (persisted state cleanup)
  • Added i18n keys (largeDiff.label, largeDiff.clickToExpand) across all 16 locales

Verification

  1. Open a session with a large file change (500+ lines)
  2. Open review panel → large file should be collapsed, showing line count
  3. Click the file header → warning appears ("1234 lines — click again to expand")
  4. Click again within 3s → file expands
  5. Wait 3s without clicking → warning disappears, resets to initial state
  6. Click "Expand All" → only small files expand
  7. Close review panel, reopen → large files are collapsed again
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/13299 **State:** open **Merged:** No --- Fixes #13297 ## What Review panel freezes when files with large diffs (500+ lines) are auto-expanded. ## Why The existing logic only checks total file count to decide expand/collapse, ignoring individual diff size. A single 2000-line diff can lock up the UI. ## How - Files with `additions + deletions > 500` are collapsed by default - "Expand All" skips large files - Click-to-confirm: first click shows line count warning, second click within 3s expands - Auto-collapse large files when review panel unmounts (persisted state cleanup) - Added i18n keys (`largeDiff.label`, `largeDiff.clickToExpand`) across all 16 locales ## Verification 1. Open a session with a large file change (500+ lines) 2. Open review panel → large file should be collapsed, showing line count 3. Click the file header → warning appears ("1234 lines — click again to expand") 4. Click again within 3s → file expands 5. Wait 3s without clicking → warning disappears, resets to initial state 6. Click "Expand All" → only small files expand 7. Close review panel, reopen → large files are collapsed again
yindo added the pull-request label 2026-02-16 18:19:23 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14605