The open source coding agent.
TypeScript
fix(app): lower threshold for diff hiding
Adam2611c35acc3d
diff --git a/packages/ui/src/components/session-review.tsx b/packages/ui/src/components/session-review.tsxindex 5f1e6b1aba5..6ab922262b7 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 = 500export 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.deletionsconst tooLarge = createMemo(() => {if (!expanded()) return falseif (force()) return falseif (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")}</div><div data-slot="session-review-large-diff-meta">- 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(),+ })}</div><div data-slot="session-review-large-diff-actions"><Button size="normal" variant="secondary" onClick={() => setForce(true)}>diff --git a/packages/ui/src/i18n/ar.ts b/packages/ui/src/i18n/ar.tsindex aa30bbd57cd..e574e9ce03c 100644--- a/packages/ui/src/i18n/ar.ts+++ b/packages/ui/src/i18n/ar.ts@@ -11,7 +11,7 @@ export const dict = {"ui.sessionReview.image.loading": "جار التحميل...","ui.sessionReview.image.placeholder": "صورة","ui.sessionReview.largeDiff.title": "Diff كبير جدا لعرضه",- "ui.sessionReview.largeDiff.meta": "الحد: {{lines}} سطر / {{limit}}. الحالي: {{current}}.",+ "ui.sessionReview.largeDiff.meta": "الحد: {{limit}} سطرًا متغيرًا. الحالي: {{current}} سطرًا متغيرًا.","ui.sessionReview.largeDiff.renderAnyway": "اعرض على أي حال","ui.lineComment.label.prefix": "تعليق على ",diff --git a/packages/ui/src/i18n/br.ts b/packages/ui/src/i18n/br.tsindex ca34e4a04dd..e985396827a 100644--- a/packages/ui/src/i18n/br.ts+++ b/packages/ui/src/i18n/br.ts@@ -11,7 +11,7 @@ export const dict = {"ui.sessionReview.image.loading": "Carregando...","ui.sessionReview.image.placeholder": "Imagem","ui.sessionReview.largeDiff.title": "Diff grande demais para renderizar",- "ui.sessionReview.largeDiff.meta": "Limite: {{lines}} linhas / {{limit}}. Atual: {{current}}.",+ "ui.sessionReview.largeDiff.meta": "Limite: {{limit}} linhas alteradas. Atual: {{current}} linhas alteradas.","ui.sessionReview.largeDiff.renderAnyway": "Renderizar mesmo assim","ui.lineComment.label.prefix": "Comentar em ",diff --git a/packages/ui/src/i18n/bs.ts b/packages/ui/src/i18n/bs.tsindex 5b9a2443b64..6726c45d2e2 100644--- a/packages/ui/src/i18n/bs.ts+++ b/packages/ui/src/i18n/bs.ts@@ -15,7 +15,7 @@ export const dict = {"ui.sessionReview.image.loading": "Učitavanje...","ui.sessionReview.image.placeholder": "Slika","ui.sessionReview.largeDiff.title": "Diff je prevelik za prikaz",- "ui.sessionReview.largeDiff.meta": "Limit: {{lines}} linija / {{limit}}. Trenutno: {{current}}.",+ "ui.sessionReview.largeDiff.meta": "Limit: {{limit}} izmijenjenih linija. Trenutno: {{current}} izmijenjenih linija.","ui.sessionReview.largeDiff.renderAnyway": "Prikaži svejedno","ui.lineComment.label.prefix": "Komentar na ",diff --git a/packages/ui/src/i18n/da.ts b/packages/ui/src/i18n/da.tsindex 4abdce54766..bd7f06a230f 100644--- a/packages/ui/src/i18n/da.ts+++ b/packages/ui/src/i18n/da.ts@@ -12,7 +12,7 @@ export const dict = {"ui.sessionReview.image.loading": "Indlæser...","ui.sessionReview.image.placeholder": "Billede","ui.sessionReview.largeDiff.title": "Diff er for stor til at blive vist",- "ui.sessionReview.largeDiff.meta": "Grænse: {{lines}} linjer / {{limit}}. Nuværende: {{current}}.",+ "ui.sessionReview.largeDiff.meta": "Grænse: {{limit}} ændrede linjer. Nuværende: {{current}} ændrede linjer.","ui.sessionReview.largeDiff.renderAnyway": "Vis alligevel","ui.lineComment.label.prefix": "Kommenter på ","ui.lineComment.label.suffix": "",diff --git a/packages/ui/src/i18n/de.ts b/packages/ui/src/i18n/de.tsindex a2427332ea8..a07ff6241a8 100644--- a/packages/ui/src/i18n/de.ts+++ b/packages/ui/src/i18n/de.ts@@ -16,7 +16,7 @@ export const dict = {"ui.sessionReview.image.loading": "Wird geladen...","ui.sessionReview.image.placeholder": "Bild","ui.sessionReview.largeDiff.title": "Diff zu groß zum Rendern",- "ui.sessionReview.largeDiff.meta": "Limit: {{lines}} Zeilen / {{limit}}. Aktuell: {{current}}.",+ "ui.sessionReview.largeDiff.meta": "Limit: {{limit}} geänderte Zeilen. Aktuell: {{current}} geänderte Zeilen.","ui.sessionReview.largeDiff.renderAnyway": "Trotzdem rendern","ui.lineComment.label.prefix": "Kommentar zu ","ui.lineComment.label.suffix": "",diff --git a/packages/ui/src/i18n/en.ts b/packages/ui/src/i18n/en.tsindex 72d35dbd706..a33ff764045 100644--- a/packages/ui/src/i18n/en.ts+++ b/packages/ui/src/i18n/en.ts@@ -11,7 +11,7 @@ export const dict = {"ui.sessionReview.image.loading": "Loading...","ui.sessionReview.image.placeholder": "Image","ui.sessionReview.largeDiff.title": "Diff too large to render",- "ui.sessionReview.largeDiff.meta": "Limit: {{lines}} lines / {{limit}}. Current: {{current}}.",+ "ui.sessionReview.largeDiff.meta": "Limit: {{limit}} changed lines. Current: {{current}} changed lines.","ui.sessionReview.largeDiff.renderAnyway": "Render anyway","ui.lineComment.label.prefix": "Comment on ",diff --git a/packages/ui/src/i18n/es.ts b/packages/ui/src/i18n/es.tsindex 7179c6345e7..dcf8d569dc1 100644--- a/packages/ui/src/i18n/es.ts+++ b/packages/ui/src/i18n/es.ts@@ -11,7 +11,7 @@ export const dict = {"ui.sessionReview.image.loading": "Cargando...","ui.sessionReview.image.placeholder": "Imagen","ui.sessionReview.largeDiff.title": "Diff demasiado grande para renderizar",- "ui.sessionReview.largeDiff.meta": "Límite: {{lines}} líneas / {{limit}}. Actual: {{current}}.",+ "ui.sessionReview.largeDiff.meta": "Límite: {{limit}} líneas modificadas. Actual: {{current}} líneas modificadas.","ui.sessionReview.largeDiff.renderAnyway": "Renderizar de todos modos","ui.lineComment.label.prefix": "Comentar en ",diff --git a/packages/ui/src/i18n/fr.ts b/packages/ui/src/i18n/fr.tsindex 6885f4c58af..c1832e8389f 100644--- a/packages/ui/src/i18n/fr.ts+++ b/packages/ui/src/i18n/fr.ts@@ -11,7 +11,7 @@ export const dict = {"ui.sessionReview.image.loading": "Chargement...","ui.sessionReview.image.placeholder": "Image","ui.sessionReview.largeDiff.title": "Diff trop volumineux pour être affiché",- "ui.sessionReview.largeDiff.meta": "Limite : {{lines}} lignes / {{limit}}. Actuel : {{current}}.",+ "ui.sessionReview.largeDiff.meta": "Limite : {{limit}} lignes modifiées. Actuel : {{current}} lignes modifiées.","ui.sessionReview.largeDiff.renderAnyway": "Afficher quand même","ui.lineComment.label.prefix": "Commenter sur ",diff --git a/packages/ui/src/i18n/ja.ts b/packages/ui/src/i18n/ja.tsindex 7d357c57e12..24d8497c13b 100644--- a/packages/ui/src/i18n/ja.ts+++ b/packages/ui/src/i18n/ja.ts@@ -12,7 +12,7 @@ export const dict = {"ui.sessionReview.image.loading": "読み込み中...","ui.sessionReview.image.placeholder": "画像","ui.sessionReview.largeDiff.title": "差分が大きすぎて表示できません",- "ui.sessionReview.largeDiff.meta": "上限: {{lines}} 行 / {{limit}}。現在: {{current}}。",+ "ui.sessionReview.largeDiff.meta": "上限: {{limit}} 変更行。現在: {{current}} 変更行。","ui.sessionReview.largeDiff.renderAnyway": "それでも表示する","ui.lineComment.label.prefix": "","ui.lineComment.label.suffix": "へのコメント",diff --git a/packages/ui/src/i18n/ko.ts b/packages/ui/src/i18n/ko.tsindex 7bfea2819d7..412234c61fc 100644--- a/packages/ui/src/i18n/ko.ts+++ b/packages/ui/src/i18n/ko.ts@@ -11,7 +11,7 @@ export const dict = {"ui.sessionReview.image.loading": "로딩 중...","ui.sessionReview.image.placeholder": "이미지","ui.sessionReview.largeDiff.title": "차이가 너무 커서 렌더링할 수 없습니다",- "ui.sessionReview.largeDiff.meta": "제한: {{lines}}줄 / {{limit}}. 현재: {{current}}.",+ "ui.sessionReview.largeDiff.meta": "제한: {{limit}} 변경 줄. 현재: {{current}} 변경 줄.","ui.sessionReview.largeDiff.renderAnyway": "그래도 렌더링","ui.lineComment.label.prefix": "",diff --git a/packages/ui/src/i18n/no.ts b/packages/ui/src/i18n/no.tsindex caea05827c2..434b8228b38 100644--- a/packages/ui/src/i18n/no.ts+++ b/packages/ui/src/i18n/no.ts@@ -14,7 +14,7 @@ export const dict: Record<Keys, string> = {"ui.sessionReview.image.loading": "Laster...","ui.sessionReview.image.placeholder": "Bilde","ui.sessionReview.largeDiff.title": "Diff er for stor til å gjengi",- "ui.sessionReview.largeDiff.meta": "Grense: {{lines}} linjer / {{limit}}. Nåværende: {{current}}.",+ "ui.sessionReview.largeDiff.meta": "Grense: {{limit}} endrede linjer. Nåværende: {{current}} endrede linjer.","ui.sessionReview.largeDiff.renderAnyway": "Gjengi likevel","ui.lineComment.label.prefix": "Kommenter på ",diff --git a/packages/ui/src/i18n/pl.ts b/packages/ui/src/i18n/pl.tsindex 9d1a860bbcf..5fd3092b7f3 100644--- a/packages/ui/src/i18n/pl.ts+++ b/packages/ui/src/i18n/pl.ts@@ -12,7 +12,7 @@ export const dict = {"ui.sessionReview.image.loading": "Ładowanie...","ui.sessionReview.image.placeholder": "Obraz","ui.sessionReview.largeDiff.title": "Diff jest zbyt duży, aby go wyrenderować",- "ui.sessionReview.largeDiff.meta": "Limit: {{lines}} linii / {{limit}}. Obecnie: {{current}}.",+ "ui.sessionReview.largeDiff.meta": "Limit: {{limit}} zmienionych linii. Obecnie: {{current}} zmienionych linii.","ui.sessionReview.largeDiff.renderAnyway": "Renderuj mimo to","ui.lineComment.label.prefix": "Komentarz do ","ui.lineComment.label.suffix": "",diff --git a/packages/ui/src/i18n/ru.ts b/packages/ui/src/i18n/ru.tsindex 1c363da2ab6..f5bed24d5fd 100644--- a/packages/ui/src/i18n/ru.ts+++ b/packages/ui/src/i18n/ru.ts@@ -12,7 +12,7 @@ export const dict = {"ui.sessionReview.image.loading": "Загрузка...","ui.sessionReview.image.placeholder": "Изображение","ui.sessionReview.largeDiff.title": "Diff слишком большой для отображения",- "ui.sessionReview.largeDiff.meta": "Лимит: {{lines}} строк / {{limit}}. Текущий: {{current}}.",+ "ui.sessionReview.largeDiff.meta": "Лимит: {{limit}} изменённых строк. Текущий: {{current}} изменённых строк.","ui.sessionReview.largeDiff.renderAnyway": "Отобразить всё равно","ui.lineComment.label.prefix": "Комментарий к ","ui.lineComment.label.suffix": "",diff --git a/packages/ui/src/i18n/th.ts b/packages/ui/src/i18n/th.tsindex ef8517af29a..2f25641926d 100644--- a/packages/ui/src/i18n/th.ts+++ b/packages/ui/src/i18n/th.ts@@ -11,7 +11,8 @@ export const dict = {"ui.sessionReview.image.loading": "กำลังโหลด...","ui.sessionReview.image.placeholder": "รูปภาพ","ui.sessionReview.largeDiff.title": "Diff มีขนาดใหญ่เกินไปจนไม่สามารถแสดงผลได้",- "ui.sessionReview.largeDiff.meta": "ขีดจำกัด: {{lines}} บรรทัด / {{limit}}. ปัจจุบัน: {{current}}.",+ "ui.sessionReview.largeDiff.meta":+ "ขีดจำกัด: {{limit}} บรรทัดที่เปลี่ยนแปลง. ปัจจุบัน: {{current}} บรรทัดที่เปลี่ยนแปลง.","ui.sessionReview.largeDiff.renderAnyway": "แสดงผลต่อไป","ui.lineComment.label.prefix": "แสดงความคิดเห็นบน ",diff --git a/packages/ui/src/i18n/zh.ts b/packages/ui/src/i18n/zh.tsindex 2c3bcf1d8e6..d651d25ab16 100644--- a/packages/ui/src/i18n/zh.ts+++ b/packages/ui/src/i18n/zh.ts@@ -15,7 +15,7 @@ export const dict = {"ui.sessionReview.image.loading": "加载中...","ui.sessionReview.image.placeholder": "图片","ui.sessionReview.largeDiff.title": "差异过大,无法渲染",- "ui.sessionReview.largeDiff.meta": "限制:{{lines}} 行 / {{limit}}。当前:{{current}}。",+ "ui.sessionReview.largeDiff.meta": "限制:{{limit}} 行变更。当前:{{current}} 行变更。","ui.sessionReview.largeDiff.renderAnyway": "仍然渲染","ui.lineComment.label.prefix": "评论 ",diff --git a/packages/ui/src/i18n/zht.ts b/packages/ui/src/i18n/zht.tsindex 00cbbd79d90..d20c2f9b2ed 100644--- a/packages/ui/src/i18n/zht.ts+++ b/packages/ui/src/i18n/zht.ts@@ -15,7 +15,7 @@ export const dict = {"ui.sessionReview.image.loading": "載入中...","ui.sessionReview.image.placeholder": "圖片","ui.sessionReview.largeDiff.title": "差異過大,無法渲染",- "ui.sessionReview.largeDiff.meta": "限制:{{lines}} 行 / {{limit}}。目前:{{current}}。",+ "ui.sessionReview.largeDiff.meta": "限制:{{limit}} 行變更。目前:{{current}} 行變更。","ui.sessionReview.largeDiff.renderAnyway": "仍然渲染","ui.lineComment.label.prefix": "評論 ",