-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -650,6 +650,13 @@ export class ChatViewPane extends ViewPane implements IViewWelcomeDelegate { | |||||
| sessionsControl.reveal(sessionResource); | ||||||
| } | ||||||
| })); | ||||||
|
|
||||||
| // When showing sessions stacked, adjust the height of the sessions list to make room for chat input | ||||||
| this._register(chatWidget.onDidChangeContentHeight(() => { | ||||||
| if (this.sessionsViewerOrientation === AgentSessionsViewerOrientation.Stacked && this.lastDimensions) { | ||||||
| this.layoutBody(this.lastDimensions.height, this.lastDimensions.width); | ||||||
| } | ||||||
| })); | ||||||
| } | ||||||
|
|
||||||
| private setupContextMenu(parent: HTMLElement): void { | ||||||
|
|
@@ -795,7 +802,22 @@ export class ChatViewPane extends ViewPane implements IViewWelcomeDelegate { | |||||
|
|
||||||
| //#region Layout | ||||||
|
|
||||||
| private layoutingBody = false; | ||||||
|
|
||||||
| protected override layoutBody(height: number, width: number): void { | ||||||
| if (this.layoutingBody) { | ||||||
| return; // prevent re-entrancy | ||||||
| } | ||||||
|
|
||||||
| this.layoutingBody = true; | ||||||
| try { | ||||||
| this.doLayoutBody(height, width); | ||||||
| } finally { | ||||||
| this.layoutingBody = false; | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| private doLayoutBody(height: number, width: number): void { | ||||||
| super.layoutBody(height, width); | ||||||
|
|
||||||
| this.lastDimensions = { height, width }; | ||||||
|
|
@@ -906,7 +928,7 @@ export class ChatViewPane extends ViewPane implements IViewWelcomeDelegate { | |||||
|
|
||||||
| 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); | ||||||
|
||||||
| 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); |
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
onDidChangeContentHeightevent fires frequently during content updates. This listener triggers a fulllayoutBodycall 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 aRunOnceScheduleror check if the height delta exceeds a threshold before re-layouting.