Skip to content

Commit b9195f2

Browse files
committed
🤖 Add debug logging to ResizeObserver to diagnose stuck width
- Log element reference, initial size, and resize events - Both ChatArea instances now have ref attached (lines 351, 410) - Should help identify why chatAreaWidth stays at 1000
1 parent 3af17fa commit b9195f2

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

src/components/AIView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ const AIViewInner: React.FC<AIViewProps> = ({
407407
return (
408408
<ChatProvider messages={messages} cmuxMessages={cmuxMessages} model={currentModel ?? "unknown"}>
409409
<ViewContainer className={className}>
410-
<ChatArea>
410+
<ChatArea ref={chatAreaRef}>
411411
<ViewHeader>
412412
<WorkspaceTitle>
413413
<StatusIndicator

src/components/ChatMetaSidebar.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,7 @@ export const ChatMetaSidebar: React.FC<ChatMetaSidebarProps> = ({ workspaceId, c
109109
const showCollapsed = chatAreaWidth <= CHAT_AREA_COMFORTABLE_WIDTH;
110110

111111
// Debug logging
112-
console.log(
113-
"[ChatMetaSidebar] chatAreaWidth:",
114-
chatAreaWidth,
115-
"showCollapsed:",
116-
showCollapsed
117-
);
112+
console.log("[ChatMetaSidebar] chatAreaWidth:", chatAreaWidth, "showCollapsed:", showCollapsed);
118113

119114
return (
120115
<SidebarContainer

src/hooks/useResizeObserver.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,16 @@ export function useResizeObserver(ref: RefObject<HTMLElement>): Size | null {
1313

1414
useEffect(() => {
1515
const element = ref.current;
16-
if (!element) return;
16+
console.log("[useResizeObserver] element:", element);
17+
if (!element) {
18+
console.log("[useResizeObserver] No element, returning early");
19+
return;
20+
}
1721

1822
const observer = new ResizeObserver((entries) => {
1923
for (const entry of entries) {
2024
const { width, height } = entry.contentRect;
25+
console.log("[useResizeObserver] ResizeObserver fired:", width, height);
2126
setSize({ width, height });
2227
}
2328
});
@@ -26,6 +31,7 @@ export function useResizeObserver(ref: RefObject<HTMLElement>): Size | null {
2631

2732
// Set initial size
2833
const { width, height } = element.getBoundingClientRect();
34+
console.log("[useResizeObserver] Initial size:", width, height);
2935
setSize({ width, height });
3036

3137
return () => {

0 commit comments

Comments
 (0)