Skip to content

Commit 8d284fc

Browse files
Copilotosortega
andcommitted
Add error handling and documentation to progress indicator implementation
Co-authored-by: osortega <[email protected]>
1 parent ad47406 commit 8d284fc

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

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

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -688,28 +688,46 @@ class SessionsViewPane extends ViewPane {
688688
}
689689
}
690690

691+
/**
692+
* Refreshes the tree data with progress indication.
693+
* Shows a progress indicator while the tree updates its children from the provider.
694+
*/
691695
private async refreshTreeWithProgress(): Promise<void> {
692696
if (!this.tree) {
693697
return;
694698
}
695699

696700
const progressIndicator = this.getProgressIndicator();
697701

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
702+
try {
703+
// Show progress while refreshing tree data
704+
const refreshPromise = this.tree.updateChildren(this.provider);
705+
await progressIndicator.showWhile(refreshPromise, 0); // Show immediately, no delay
706+
} catch (error) {
707+
// Log error but don't throw to avoid breaking the UI
708+
console.error('Error refreshing chat sessions tree:', error);
709+
}
701710
}
702711

712+
/**
713+
* Loads initial tree data with progress indication.
714+
* Shows a progress indicator while the tree loads data from the provider.
715+
*/
703716
private async loadDataWithProgress(): Promise<void> {
704717
if (!this.tree) {
705718
return;
706719
}
707720

708721
const progressIndicator = this.getProgressIndicator();
709722

710-
// Show progress while loading data
711-
const loadingPromise = this.tree.setInput(this.provider);
712-
await progressIndicator.showWhile(loadingPromise, 0); // Show immediately, no delay
723+
try {
724+
// Show progress while loading data
725+
const loadingPromise = this.tree.setInput(this.provider);
726+
await progressIndicator.showWhile(loadingPromise, 0); // Show immediately, no delay
727+
} catch (error) {
728+
// Log error but don't throw to avoid breaking the UI
729+
console.error('Error loading chat sessions data:', error);
730+
}
713731
}
714732

715733
protected override renderBody(container: HTMLElement): void {

0 commit comments

Comments
 (0)