Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
Fix chat attachment height on narrow timeline resizes
Julius Marmingea76413594e77
diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsxindex 3101b9403..ff8900d1d 100644--- a/apps/web/src/components/ChatView.tsx+++ b/apps/web/src/components/ChatView.tsx@@ -3206,16 +3206,14 @@ const MessagesTimeline = memo(function MessagesTimeline({updateWidth(timelineRoot.getBoundingClientRect().width);if (typeof ResizeObserver === "undefined") return;- const observer = new ResizeObserver((entries) => {- const [entry] = entries;- if (!entry) return;- updateWidth(entry.contentRect.width);+ const observer = new ResizeObserver(() => {+ updateWidth(timelineRoot.getBoundingClientRect().width);});observer.observe(timelineRoot);return () => {observer.disconnect();};- }, []);+ }, [hasMessages, isWorking]);const rows = useMemo<TimelineRow[]>(() => {const nextRows: TimelineRow[] = [];diff --git a/apps/web/src/components/timelineHeight.test.ts b/apps/web/src/components/timelineHeight.test.tsindex df9d00aac..613b20957 100644--- a/apps/web/src/components/timelineHeight.test.ts+++ b/apps/web/src/components/timelineHeight.test.ts@@ -76,6 +76,16 @@ describe("estimateTimelineMessageHeight", () => {expect(estimateTimelineMessageHeight(message, { timelineWidthPx: 768 })).toBe(118);});+ it("does not clamp user wrapping too aggressively on very narrow layouts", () => {+ const message = {+ role: "user" as const,+ text: "a".repeat(20),+ };++ expect(estimateTimelineMessageHeight(message, { timelineWidthPx: 100 })).toBe(184);+ expect(estimateTimelineMessageHeight(message, { timelineWidthPx: 320 })).toBe(118);+ });+it("uses narrower width to increase assistant line wrapping", () => {const message = {role: "assistant" as const,diff --git a/apps/web/src/components/timelineHeight.ts b/apps/web/src/components/timelineHeight.tsindex 5bf9e1103..993736789 100644--- a/apps/web/src/components/timelineHeight.ts+++ b/apps/web/src/components/timelineHeight.ts@@ -11,7 +11,7 @@ const USER_BUBBLE_HORIZONTAL_PADDING_PX = 32;const ASSISTANT_MESSAGE_HORIZONTAL_PADDING_PX = 8;const USER_MONO_AVG_CHAR_WIDTH_PX = 8.4;const ASSISTANT_AVG_CHAR_WIDTH_PX = 7.2;-const MIN_USER_CHARS_PER_LINE = 16;+const MIN_USER_CHARS_PER_LINE = 4;const MIN_ASSISTANT_CHARS_PER_LINE = 20;interface TimelineMessageHeightInput {