Skip to content

Commit

Permalink
Merge branch 'mwf/generic-parent-item' of https://github.com/microsof…
Browse files Browse the repository at this point in the history
…t/vscode-azuretools into mwf/activity-log-nesting
  • Loading branch information
MicroFish91 committed Nov 30, 2023
2 parents 8879f38 + caa488c commit 1a93436
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion utils/src/tree/AzExtTreeItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,14 @@ export abstract class AzExtTreeItem implements types.AzExtTreeItem {
return undefined;
}

if (this.parent && this.treeDataProvider.collapsibleStateTracker) {
/**
* Reference: https://github.com/microsoft/vscode-azuretools/pull/1635/files#r1408222203
*
* `GenericParentTreeItem` has the option to be defined without a parent or tree data provider (for example, when utilized for the activity log)
* To avoid `nonNull` errors from being thrown, don't call the getter for `treeDataProvider` if none of the associated fields are populated.
*/
const hasTreeDataProvider: boolean = !!this._treeDataProvider || !!this.parent?.treeDataProvider;
if (hasTreeDataProvider && this.treeDataProvider.collapsibleStateTracker) {
return this.treeDataProvider.collapsibleStateTracker.getCollapsibleState(this);
}

Expand Down

0 comments on commit 1a93436

Please sign in to comment.