Skip to content

Commit ad47406

Browse files
Copilotosortega
andcommitted
Add progress indication to chat sessions async data loading
Co-authored-by: osortega <[email protected]>
1 parent 791acfb commit ad47406

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

src/vs/workbench/contrib/chat/browser/chatSessions.ts

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ class SessionsViewPane extends ViewPane {
672672
if (provider instanceof LocalChatSessionsProvider) {
673673
this._register(provider.onDidChange(() => {
674674
if (this.tree && this.isBodyVisible()) {
675-
this.tree.updateChildren(this.provider);
675+
this.refreshTreeWithProgress();
676676
}
677677
}));
678678
}
@@ -684,10 +684,34 @@ class SessionsViewPane extends ViewPane {
684684

685685
public refreshTree(): void {
686686
if (this.tree && this.isBodyVisible()) {
687-
this.tree.updateChildren(this.provider);
687+
this.refreshTreeWithProgress();
688688
}
689689
}
690690

691+
private async refreshTreeWithProgress(): Promise<void> {
692+
if (!this.tree) {
693+
return;
694+
}
695+
696+
const progressIndicator = this.getProgressIndicator();
697+
698+
// Show progress while refreshing tree data
699+
const refreshPromise = this.tree.updateChildren(this.provider);
700+
await progressIndicator.showWhile(refreshPromise, 0); // Show immediately, no delay
701+
}
702+
703+
private async loadDataWithProgress(): Promise<void> {
704+
if (!this.tree) {
705+
return;
706+
}
707+
708+
const progressIndicator = this.getProgressIndicator();
709+
710+
// Show progress while loading data
711+
const loadingPromise = this.tree.setInput(this.provider);
712+
await progressIndicator.showWhile(loadingPromise, 0); // Show immediately, no delay
713+
}
714+
691715
protected override renderBody(container: HTMLElement): void {
692716
super.renderBody(container);
693717

@@ -753,13 +777,13 @@ class SessionsViewPane extends ViewPane {
753777
// Handle visibility changes to load data
754778
this._register(this.onDidChangeBodyVisibility(async visible => {
755779
if (visible && this.tree) {
756-
await this.tree.setInput(this.provider);
780+
await this.loadDataWithProgress();
757781
}
758782
}));
759783

760784
// Initially load data if visible
761785
if (this.isBodyVisible() && this.tree) {
762-
this.tree.setInput(this.provider);
786+
this.loadDataWithProgress();
763787
}
764788
}
765789

0 commit comments

Comments
 (0)