From 2611c35acc3dc64582e15ad1efca36c60a2883a8 Mon Sep 17 00:00:00 2001
From: Adam <2363879+adamdotdevin@users.noreply.github.com>
Date: Wed, 18 Feb 2026 08:40:01 -0600
Subject: [PATCH] fix(app): lower threshold for diff hiding
---
packages/ui/src/components/session-review.tsx | 35 ++++---------------
packages/ui/src/i18n/ar.ts | 2 +-
packages/ui/src/i18n/br.ts | 2 +-
packages/ui/src/i18n/bs.ts | 2 +-
packages/ui/src/i18n/da.ts | 2 +-
packages/ui/src/i18n/de.ts | 2 +-
packages/ui/src/i18n/en.ts | 2 +-
packages/ui/src/i18n/es.ts | 2 +-
packages/ui/src/i18n/fr.ts | 2 +-
packages/ui/src/i18n/ja.ts | 2 +-
packages/ui/src/i18n/ko.ts | 2 +-
packages/ui/src/i18n/no.ts | 2 +-
packages/ui/src/i18n/pl.ts | 2 +-
packages/ui/src/i18n/ru.ts | 2 +-
packages/ui/src/i18n/th.ts | 3 +-
packages/ui/src/i18n/zh.ts | 2 +-
packages/ui/src/i18n/zht.ts | 2 +-
17 files changed, 24 insertions(+), 44 deletions(-)
diff --git a/packages/ui/src/components/session-review.tsx b/packages/ui/src/components/session-review.tsx
index 5f1e6b1ab..6ab922262 100644
--- a/packages/ui/src/components/session-review.tsx
+++ b/packages/ui/src/components/session-review.tsx
@@ -17,25 +17,7 @@ import { PreloadMultiFileDiffResult } from "@pierre/diffs/ssr"
import { type SelectedLineRange } from "@pierre/diffs"
import { Dynamic } from "solid-js/web"
-const MAX_DIFF_LINES = 20_000
-const MAX_DIFF_BYTES = 2_000_000
-
-function linesOver(text: string, max: number) {
- let lines = 1
- for (let i = 0; i < text.length; i++) {
- if (text.charCodeAt(i) !== 10) continue
- lines++
- if (lines > max) return true
- }
- return lines > max
-}
-
-function formatBytes(bytes: number) {
- if (!Number.isFinite(bytes) || bytes <= 0) return "0 B"
- if (bytes < 1024) return `${bytes} B`
- if (bytes < 1024 * 1024) return `${Math.round((bytes / 1024) * 10) / 10} KB`
- return `${Math.round((bytes / (1024 * 1024)) * 10) / 10} MB`
-}
+const MAX_DIFF_CHANGED_LINES = 500
export type SessionReviewDiffStyle = "unified" | "split"
@@ -354,18 +336,13 @@ export const SessionReview = (props: SessionReviewProps) => {
const beforeText = () => (typeof diff.before === "string" ? diff.before : "")
const afterText = () => (typeof diff.after === "string" ? diff.after : "")
+ const changedLines = () => diff.additions + diff.deletions
const tooLarge = createMemo(() => {
if (!expanded()) return false
if (force()) return false
if (isImageFile(diff.file)) return false
-
- const before = beforeText()
- const after = afterText()
-
- if (before.length > MAX_DIFF_BYTES || after.length > MAX_DIFF_BYTES) return true
- if (linesOver(before, MAX_DIFF_LINES) || linesOver(after, MAX_DIFF_LINES)) return true
- return false
+ return changedLines() > MAX_DIFF_CHANGED_LINES
})
const isAdded = () => diff.status === "added" || (beforeText().length === 0 && afterText().length > 0)
@@ -636,8 +613,10 @@ export const SessionReview = (props: SessionReviewProps) => {
{i18n.t("ui.sessionReview.largeDiff.title")}
- Limit: {MAX_DIFF_LINES.toLocaleString()} lines / {formatBytes(MAX_DIFF_BYTES)}.
- Current: {formatBytes(Math.max(beforeText().length, afterText().length))}.
+ {i18n.t("ui.sessionReview.largeDiff.meta", {
+ limit: MAX_DIFF_CHANGED_LINES.toLocaleString(),
+ current: changedLines().toLocaleString(),
+ })}