Skip to content

Commit b8890ac

Browse files
t3dotggclaude
andcommitted
fix(web): short branch names no longer get clipped in thread details
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 7f26969 commit b8890ac

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { describe, expect, it } from "vite-plus/test";
2+
3+
import { render } from "../../../test/render";
4+
import { MiddleTruncate } from "./middle-truncate";
5+
6+
import "~/index.css";
7+
8+
const narrow = (value: string) => (
9+
<div style={{ width: 80 }}>
10+
<MiddleTruncate value={value} className="w-full" />
11+
</div>
12+
);
13+
14+
describe("MiddleTruncate", () => {
15+
it("does not clip a short value that replaces a truncated one", async () => {
16+
await using screen = await render(narrow("t3/investigate-release-build-times"));
17+
const label = () => screen.container.querySelector("[title] > span");
18+
await expect.poll(() => label()?.hasAttribute("data-overflow")).toBe(true);
19+
20+
await screen.rerender(narrow("main"));
21+
22+
expect(label()).toHaveTextContent("main");
23+
expect(label()).not.toHaveAttribute("data-overflow");
24+
expect(label()).toHaveStyle({ clipPath: "none" });
25+
});
26+
});

‎apps/web/src/components/ui/middle-truncate.tsx‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ export function MiddleTruncate({
4747
<span className="shrink-0 peer-data-overflow:before:content-['…']">{split.tail}</span>
4848
</>
4949
) : (
50-
<span className="min-w-0 truncate">{value}</span>
50+
// Keyed so React does not reuse the head node and its imperative clip.
51+
<span key="whole" className="min-w-0 truncate">
52+
{value}
53+
</span>
5154
)}
5255
</span>
5356
);

0 commit comments

Comments
 (0)