diff options
| author | Adam <[email protected]> | 2026-02-18 08:40:01 -0600 |
|---|---|---|
| committer | Adam <[email protected]> | 2026-02-18 08:40:05 -0600 |
| commit | 2611c35acc3dc64582e15ad1efca36c60a2883a8 (patch) | |
| tree | 13eabb05c8ec37d50ad8ef7536385a2c5f669a10 | |
| parent | 00c238777ae11dfd61c6249426cd201fc3612f1b (diff) | |
| download | opencode-2611c35acc3dc64582e15ad1efca36c60a2883a8.tar.gz opencode-2611c35acc3dc64582e15ad1efca36c60a2883a8.zip | |
fix(app): lower threshold for diff hiding
| -rw-r--r-- | packages/ui/src/components/session-review.tsx | 35 | ||||
| -rw-r--r-- | packages/ui/src/i18n/ar.ts | 2 | ||||
| -rw-r--r-- | packages/ui/src/i18n/br.ts | 2 | ||||
| -rw-r--r-- | packages/ui/src/i18n/bs.ts | 2 | ||||
| -rw-r--r-- | packages/ui/src/i18n/da.ts | 2 | ||||
| -rw-r--r-- | packages/ui/src/i18n/de.ts | 2 | ||||
| -rw-r--r-- | packages/ui/src/i18n/en.ts | 2 | ||||
| -rw-r--r-- | packages/ui/src/i18n/es.ts | 2 | ||||
| -rw-r--r-- | packages/ui/src/i18n/fr.ts | 2 | ||||
| -rw-r--r-- | packages/ui/src/i18n/ja.ts | 2 | ||||
| -rw-r--r-- | packages/ui/src/i18n/ko.ts | 2 | ||||
| -rw-r--r-- | packages/ui/src/i18n/no.ts | 2 | ||||
| -rw-r--r-- | packages/ui/src/i18n/pl.ts | 2 | ||||
| -rw-r--r-- | packages/ui/src/i18n/ru.ts | 2 | ||||
| -rw-r--r-- | packages/ui/src/i18n/th.ts | 3 | ||||
| -rw-r--r-- | packages/ui/src/i18n/zh.ts | 2 | ||||
| -rw-r--r-- | 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")} </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.ts index aa30bbd57..e574e9ce0 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.ts index ca34e4a04..e98539682 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.ts index 5b9a2443b..6726c45d2 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.ts index 4abdce547..bd7f06a23 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.ts index a2427332e..a07ff6241 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.ts index 72d35dbd7..a33ff7640 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.ts index 7179c6345..dcf8d569d 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.ts index 6885f4c58..c1832e838 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.ts index 7d357c57e..24d8497c1 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.ts index 7bfea2819..412234c61 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.ts index caea05827..434b8228b 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.ts index 9d1a860bb..5fd3092b7 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.ts index 1c363da2a..f5bed24d5 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.ts index ef8517af2..2f2564192 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.ts index 2c3bcf1d8..d651d25ab 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.ts index 00cbbd79d..d20c2f9b2 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": "評論 ", |
