improvement(terminal): resize output panel on any layout change via ResizeObserver#4220
improvement(terminal): resize output panel on any layout change via ResizeObserver#4220waleedlatif1 merged 1 commit intostagingfrom
Conversation
…esizeObserver Replaces MutationObserver on document.documentElement (watching CSS variable changes) + window resize listener with a ResizeObserver on the terminal element itself. The terminal now measures its own rendered width directly, so it responds correctly to all layout changes — sidebar, workflow panel, and mothership resize — without indirect CSS variable plumbing or cross-component coupling.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview This also changes the auto-close behavior to trigger when the terminal’s own width can’t accommodate Reviewed by Cursor Bugbot for commit 86f5195. Configure here. |
Greptile SummaryThis PR replaces the terminal's Confidence Score: 5/5Safe to merge — clean bug fix with no P0 or P1 issues. All findings are P2 or lower. The core logic is correct: the ResizeObserver fires on every layout-driven width change, the closure captures the right values, the effect dependency array is unchanged from before, and the manual handleResize() call before observer.observe() ensures the initial state is correct. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Any layout change] --> B{Source}
B --> C[Sidebar resize]
B --> D[Workflow panel resize]
B --> E[Mothership/chat divider]
B --> F[Window resize]
C --> G[Terminal element width changes]
D --> G
E --> G
F --> G
G --> H[ResizeObserver fires on terminalRef]
H --> I[handleResize called]
I --> J{selectedEntry?}
J -- No --> K[Return early — no-op]
J -- Yes --> L["maxWidth = el.getBoundingClientRect().width − BLOCK_COLUMN_WIDTH"]
L --> M{maxWidth < MIN_OUTPUT_PANEL_WIDTH?}
M -- Yes --> N[Close output panel]
M -- No --> O{outputPanelWidth > maxWidth?}
O -- Yes --> P[Clamp outputPanelWidth to maxWidth]
O -- No --> Q[No state change]
Reviews (1): Last reviewed commit: "improvement(terminal): resize output pan..." | Re-trigger Greptile |
Summary
MutationObserverondocument.documentElement(watching CSS variable changes) andwindow.resizelistener with aResizeObserveron the terminal element itselfgetBoundingClientRect(), so it correctly responds to all layout changes — sidebar resize, workflow panel resize, and mothership (chat/resources) resize — without CSS variable plumbing or cross-component couplingType of Change
Testing
Tested manually
Checklist