-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Agent sessions: rendering bug when stacked sessions list is expanded and context is added (fix #288151) #288359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…and context is added (fix #288151)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a rendering bug in the agent sessions view where the stacked sessions list doesn't properly adjust its height when context is added to the chat input.
Changes:
- Added event listener to re-layout when chat widget content height changes in stacked mode
- Introduced re-entrancy guard to prevent infinite layout loops
- Updated calculation to account for actual input content height instead of just minimum height
| this._register(chatWidget.onDidChangeContentHeight(() => { | ||
| if (this.sessionsViewerOrientation === AgentSessionsViewerOrientation.Stacked && this.lastDimensions) { | ||
| this.layoutBody(this.lastDimensions.height, this.lastDimensions.width); | ||
| } | ||
| })); |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The onDidChangeContentHeight event fires frequently during content updates. This listener triggers a full layoutBody call every time, which could cause performance issues. Consider debouncing this event or checking if the height actually changed meaningfully before triggering a re-layout. You could use a RunOnceScheduler or check if the height delta exceeds a threshold before re-layouting.
| let availableSessionsHeight = height - this.sessionsTitleContainer.offsetHeight - this.sessionsLinkContainer.offsetHeight; | ||
| if (this.sessionsViewerOrientation === AgentSessionsViewerOrientation.Stacked) { | ||
| availableSessionsHeight -= ChatViewPane.MIN_CHAT_WIDGET_HEIGHT; // always reserve some space for chat input | ||
| availableSessionsHeight -= Math.max(ChatViewPane.MIN_CHAT_WIDGET_HEIGHT, this._widget?.input?.contentHeight ?? 0); |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fallback to 0 when this._widget?.input?.contentHeight is undefined means the calculation would use only MIN_CHAT_WIDGET_HEIGHT. However, if the widget or input doesn't exist, this should probably use MIN_CHAT_WIDGET_HEIGHT explicitly rather than relying on Math.max to select it. Consider making this logic more explicit: this._widget?.input?.contentHeight ?? ChatViewPane.MIN_CHAT_WIDGET_HEIGHT.
| availableSessionsHeight -= Math.max(ChatViewPane.MIN_CHAT_WIDGET_HEIGHT, this._widget?.input?.contentHeight ?? 0); | |
| availableSessionsHeight -= Math.max(ChatViewPane.MIN_CHAT_WIDGET_HEIGHT, this._widget?.input?.contentHeight ?? ChatViewPane.MIN_CHAT_WIDGET_HEIGHT); |
No description provided.