Skip to content

Commit 39c8500

Browse files
authored
utils: Ensure tree items constructed within ExecuteActivity are also idempotent (#1976)
1 parent d458767 commit 39c8500

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

utils/package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

utils/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@microsoft/vscode-azext-utils",
33
"author": "Microsoft Corporation",
4-
"version": "3.0.1",
4+
"version": "3.0.2",
55
"description": "Common UI tools for developing Azure extensions for VS Code",
66
"tags": [
77
"azure",

utils/src/activityLog/activities/ExecuteActivity.ts

+5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6+
import { v4 as uuidv4 } from "uuid";
67
import * as vscode from 'vscode';
78
import * as hTypes from '../../../hostapi';
89
import * as types from '../../../index';
@@ -23,6 +24,7 @@ export class ExecuteActivity<TContext extends types.ExecuteActivityContext = typ
2324
}
2425
}
2526

27+
private _successItemId: string = uuidv4();
2628
public successState(): hTypes.ActivityTreeItemOptions {
2729
const activityResult = this.context.activityResult;
2830
const resourceId: string | undefined = typeof activityResult === 'string' ? activityResult : activityResult?.id;
@@ -36,6 +38,7 @@ export class ExecuteActivity<TContext extends types.ExecuteActivityContext = typ
3638

3739
return [
3840
new ActivityChildItem({
41+
id: this._successItemId,
3942
contextValue: 'executeResult',
4043
label: vscode.l10n.t("Click to view resource"),
4144
activityType: ActivityChildType.Command,
@@ -51,11 +54,13 @@ export class ExecuteActivity<TContext extends types.ExecuteActivityContext = typ
5154
}
5255
}
5356

57+
private _errorItemId: string = uuidv4();
5458
public errorState(error: types.IParsedError): hTypes.ActivityTreeItemOptions {
5559
return {
5660
label: this.label,
5761
getChildren: (_parent: ResourceGroupsItem) => {
5862
const errorItemOptions: types.ActivityChildItemOptions = {
63+
id: this._errorItemId,
5964
label: error.message,
6065
contextValue: activityErrorContext,
6166
activityType: ActivityChildType.Error,

0 commit comments

Comments
 (0)