Skip to content

Commit 147f228

Browse files
claude0ski
authored andcommitted
fix(webapp): address CodeRabbit review comments
- Fixed misleading comment: "Binary search" → "Incrementally find" - Added ResizeObserver guard for jsdom/older browser compatibility https://claude.ai/code/session_01KrFXrmK7jz9sWTcS8pMtXL
1 parent f06d1a6 commit 147f228

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

apps/webapp/app/components/primitives/MiddleTruncate.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export function MiddleTruncate({ text, className }: MiddleTruncateProps) {
5858
return;
5959
}
6060

61-
// Binary search for optimal character counts
61+
// Incrementally find the optimal character counts
6262
let startChars = 0;
6363
let endChars = 0;
6464

@@ -119,7 +119,11 @@ export function MiddleTruncate({ text, className }: MiddleTruncateProps) {
119119
useLayoutEffect(() => {
120120
calculateTruncation();
121121

122-
// Recalculate on resize
122+
// Recalculate on resize (guard for jsdom/older browsers)
123+
if (typeof ResizeObserver === "undefined") {
124+
return;
125+
}
126+
123127
const resizeObserver = new ResizeObserver(() => {
124128
calculateTruncation();
125129
});

0 commit comments

Comments
 (0)