Skip to content

Commit 0211938

Browse files
authored
fix(tree-explorer): dont show message when cannot fetch estimated count VSCODE-268 (#309)
1 parent f2868c6 commit 0211938

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/explorer/collectionTreeItem.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as vscode from 'vscode';
2-
const path = require('path');
2+
import path from 'path';
33

44
import { createLogger } from '../logging';
55
import DocumentListTreeItem, {
@@ -73,7 +73,7 @@ export default class CollectionTreeItem extends vscode.TreeItem
7373

7474
private _dataService: any;
7575
private _type: CollectionTypes;
76-
documentCount: number | null;
76+
documentCount: number | null = null;
7777

7878
isExpanded: boolean;
7979

@@ -333,14 +333,20 @@ export default class CollectionTreeItem extends vscode.TreeItem
333333
}
334334

335335
refreshDocumentCount = async (): Promise<number> => {
336+
// Skip the count on views and time-series collections since it will error.
337+
if (
338+
this._type === CollectionTypes.view ||
339+
this._type === CollectionTypes.timeseries
340+
) {
341+
this.documentCount = null;
342+
return 0;
343+
}
344+
336345
try {
337346
// We fetch the document when we expand in order to show
338347
// the document count in the document list tree item `description`.
339348
this.documentCount = await this.getCount();
340349
} catch (err) {
341-
vscode.window.showInformationMessage(
342-
`Unable to fetch document count: ${err}`
343-
);
344350
return 0;
345351
}
346352

0 commit comments

Comments
 (0)