Skip to content

Commit f04064b

Browse files
BenGWeeksclaude
andcommitted
Address GitHub Copilot review feedback
- Remove Q.Promise type annotation and cast in extensionCache.ts - Migrate UNSAFE_componentWillReceiveProps to componentDidUpdate - Update VS Code tasks.json to use bun commands instead of grunt - Remove legacy tasks.json.old backup file - Add explicit userMode type handling in widget configuration - Use flushSync for accurate render timing telemetry - Remove unused state property from CompletionDropdown Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 6b61eda commit f04064b

7 files changed

Lines changed: 61 additions & 50 deletions

File tree

.vscode/tasks.json

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,42 @@
1-
// A task runner configuration.
1+
// VS Code task runner configuration
22
{
33
"version": "2.0.0",
4-
"command": "grunt",
54
"tasks": [
65
{
7-
"label": "build",
8-
"type": "grunt",
9-
"task": "build",
6+
"label": "Build (Dev)",
7+
"type": "shell",
8+
"command": "bun run package-dev",
109
"problemMatcher": "$msCompile",
1110
"group": {
12-
"_id": "build",
13-
"isDefault": false
11+
"kind": "build",
12+
"isDefault": true
1413
}
1514
},
1615
{
17-
"label": "publish",
18-
"type": "grunt",
19-
"task": "publish",
20-
"problemMatcher": "$msCompile"
16+
"label": "Build (Release)",
17+
"type": "shell",
18+
"command": "bun run package-release",
19+
"problemMatcher": "$msCompile",
20+
"group": "build"
21+
},
22+
{
23+
"label": "Lint",
24+
"type": "shell",
25+
"command": "bun run lint",
26+
"problemMatcher": "$eslint-stylish"
27+
},
28+
{
29+
"label": "Format",
30+
"type": "shell",
31+
"command": "bun run format",
32+
"problemMatcher": []
33+
},
34+
{
35+
"label": "Dev Server",
36+
"type": "shell",
37+
"command": "bun run dev",
38+
"problemMatcher": [],
39+
"isBackground": true
2140
}
2241
]
23-
}
42+
}

.vscode/tasks.json.old

Lines changed: 0 additions & 18 deletions
This file was deleted.

scripts/contributionsWidgetConfiguration.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,11 @@ VSS.require(
168168
notifyChange = widgetConfigurationContext.notify.bind(widgetConfigurationContext);
169169

170170
const settings = parseSettings(widgetSettings.customSettings.data);
171-
const baseFilter = settings.filter || (await defaultFilter.getValue());
172-
currentFilter = { ...baseFilter, userMode: baseFilter.userMode || "specific" };
171+
const baseFilter: IContributionFilter & Partial<{ userMode: UserMode }> =
172+
settings.filter || (await defaultFilter.getValue());
173+
const userMode: UserMode =
174+
("userMode" in baseFilter && baseFilter.userMode) || "specific";
175+
currentFilter = { ...baseFilter, userMode };
173176

174177
if (!root && container) {
175178
root = createRoot(container);

scripts/controls/CompletionDropdown.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,15 @@ interface ICompletionDropdownProps {
1717
label?: string;
1818
}
1919

20-
interface ICompletionDropdownState {
21-
selected?: ITag[];
22-
}
23-
2420
export class CompletionDropdown extends React.Component<
2521
ICompletionDropdownProps,
26-
ICompletionDropdownState
22+
Record<string, never>
2723
> {
2824
private static counter = 0;
2925
private readonly key: number;
3026
constructor(props: ICompletionDropdownProps) {
3127
super(props);
3228
this.key = CompletionDropdown.counter++;
33-
this.state = { selected: props.selected };
3429
}
3530
render() {
3631
return (

scripts/controls/showGraphs.tsx

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as React from "react";
22
import { createRoot, Root } from "react-dom/client";
3+
import { flushSync } from "react-dom";
34
import { DelayedFunction } from "VSS/Utils/Core";
45

56
import { IUserContributions } from "../data/contracts";
@@ -30,9 +31,11 @@ export function renderGraphs(filter: IContributionFilter) {
3031
const loadingContributions = filter.identities.map(
3132
(user): IUserContributions => ({ key: -1, data: {}, user })
3233
);
33-
root.render(
34-
<Graphs contributions={loadingContributions} loading={true} sharedScale={false} />
35-
);
34+
flushSync(() => {
35+
root.render(
36+
<Graphs contributions={loadingContributions} loading={true} sharedScale={false} />
37+
);
38+
});
3639
timings.measure("drawSpinner");
3740
}
3841
});
@@ -42,9 +45,15 @@ export function renderGraphs(filter: IContributionFilter) {
4245
showSpinner.cancel();
4346
if (currentRender === renderNum) {
4447
timings.measure("getContributions");
45-
root.render(
46-
<Graphs contributions={contributions} loading={false} sharedScale={filter.sharedScale} />
47-
);
48+
flushSync(() => {
49+
root.render(
50+
<Graphs
51+
contributions={contributions}
52+
loading={false}
53+
sharedScale={filter.sharedScale}
54+
/>
55+
);
56+
});
4857
timings.measure("drawGraph");
4958
trackEvent("loadGraph", filterToIProperties(filter), timings.measurements);
5059
}

scripts/controls/timeWindow/timeWindow.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,13 @@ export class TimeWindow extends React.Component<
3333
super(props);
3434
this.state = { contributions: this.getContributions(props) };
3535
}
36-
UNSAFE_componentWillReceiveProps(props: ITimeWindowProps) {
37-
this.setState({ contributions: this.getContributions(props) });
36+
componentDidUpdate(prevProps: ITimeWindowProps) {
37+
if (
38+
prevProps.selected !== this.props.selected ||
39+
prevProps.allContributions.key !== this.props.allContributions.key
40+
) {
41+
this.setState({ contributions: this.getContributions(this.props) });
42+
}
3843
}
3944
render() {
4045
const { selected } = this.props;

scripts/data/identities/extensionCache.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import * as Q from "q";
2-
31
const collection = "extension-cache";
42

53
interface IExtensionCacheEntry<T> {
@@ -46,15 +44,15 @@ export async function get<T>(key: string, hardGet: () => Promise<IHardGetValue<T
4644
}
4745
return doc.value;
4846
},
49-
(error: TfsError): Q.Promise<T> => {
47+
(error: TfsError) => {
5048
const status = Number(error.status);
5149
// If collection has not been created yet;
5250
if (
5351
status === 404 ||
5452
// User does not have permissions
5553
status === 401
5654
) {
57-
return hardGetAndStore() as unknown as Q.Promise<T>;
55+
return hardGetAndStore();
5856
}
5957
throw error;
6058
}

0 commit comments

Comments
 (0)