fix(site): wrap long lines in agents diff panel (#22414)

The diff view on the `/agents` page had no way to handle lines wider
than the panel. The `@pierre/diffs` library supports an `overflow`
option — switching it from `"scroll"` (the shared default) to `"wrap"`
for the side panel makes long lines wrap naturally instead of being
clipped.

Also adds a long import line to the Storybook sample diff so the
wrapping behavior is easy to verify visually.
This commit is contained in:
Danielle Maywood
2026-02-28 10:33:06 +00:00
committed by GitHub
parent 1dec6da358
commit 31ad3cdd0c
2 changed files with 3 additions and 1 deletions
@@ -9,10 +9,11 @@ const sampleUnifiedDiff = `diff --git a/site/src/pages/AgentsPage/FilesChangedPa
index abc1234..def5678 100644
--- a/site/src/pages/AgentsPage/FilesChangedPanel.tsx
+++ b/site/src/pages/AgentsPage/FilesChangedPanel.tsx
@@ -1,10 +1,14 @@
@@ -1,10 +1,15 @@
+import { useTheme } from "@emotion/react";
import { parsePatchFiles } from "@pierre/diffs";
import { FileDiff } from "@pierre/diffs/react";
+import { createContext, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore } from "react"; // deliberately long import to verify horizontal overflow handling in narrow panels
+import {
+ DIFFS_FONT_STYLE,
+ getDiffViewerOptions,
@@ -152,6 +152,7 @@ export const FilesChangedPanel: FC<FilesChangedPanelProps> = ({ chatId }) => {
fileDiff={fileDiff}
options={{
...diffOptions,
overflow: "wrap",
enableLineSelection: true,
enableHoverUtility: true,
onLineSelected() {