Skip to content

Commit a0e38e6

Browse files
Copilotd10c
andauthored
Upgrade React to v19.2.3 (and fix type errors in useRef hooks) (#4237)
* Initial plan * Merge React 19 upgrade from dependabot branch Co-authored-by: d10c <[email protected]> * Fix React 19 useRef type errors and eslint config Co-authored-by: d10c <[email protected]> * Upgrade react-dom to 19.2.3 to match react version Co-authored-by: d10c <[email protected]> * Restore correct package versions (revert unintended downgrades from dependabot merge) Co-authored-by: d10c <[email protected]> * Security fix: Update glob to 11.1.0 to address command injection vulnerability Co-authored-by: d10c <[email protected]> * Upgrade React to 19.2.3 and fix useRef type errors - Upgrade react and react-dom from 18.3.1 to 19.2.3 - Upgrade @types/react and @types/react-dom to 19.2.3 (matching versions) - Fix useRef hooks to include explicit initial values (React 19 requirement) - Update ref prop types to handle React 19's stricter null handling - Fix eslint config for reactHooks.configs compatibility Co-authored-by: d10c <[email protected]> * Fix eslint config: restore .flat accessor for reactHooks.configs The previous change removed the .flat accessor which caused ESLint to use the old eslintrc format config (with plugins as array of strings) instead of the flat config format (with plugins as object). This led to CI failures. Co-authored-by: d10c <[email protected]> * Use caret (^) prefix for React package versions Updated react, react-dom, @types/react, and @types/react-dom to use "^19.2.3" instead of "19.2.3" to match the convention used by other dependencies in the project. Co-authored-by: d10c <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: d10c <[email protected]>
1 parent 44529e4 commit a0e38e6

File tree

10 files changed

+47
-51
lines changed

10 files changed

+47
-51
lines changed

extensions/ql-vscode/package-lock.json

Lines changed: 30 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extensions/ql-vscode/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2080,8 +2080,8 @@
20802080
"nanoid": "^5.0.7",
20812081
"p-queue": "^8.0.1",
20822082
"proper-lockfile": "^4.1.2",
2083-
"react": "^18.3.1",
2084-
"react-dom": "^18.3.1",
2083+
"react": "^19.2.3",
2084+
"react-dom": "^19.2.3",
20852085
"semver": "^7.6.2",
20862086
"source-map": "^0.7.6",
20872087
"source-map-support": "^0.5.21",
@@ -2135,8 +2135,8 @@
21352135
"@types/js-yaml": "^4.0.6",
21362136
"@types/node": "22.19.*",
21372137
"@types/proper-lockfile": "^4.1.4",
2138-
"@types/react": "^18.3.12",
2139-
"@types/react-dom": "^18.3.1",
2138+
"@types/react": "^19.2.3",
2139+
"@types/react-dom": "^19.2.3",
21402140
"@types/sarif": "^2.1.2",
21412141
"@types/semver": "^7.5.8",
21422142
"@types/stream-json": "^1.7.1",

extensions/ql-vscode/src/view/model-alerts/ModelAlertsResults.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export const ModelAlertsResults = ({
7979
[modelAlerts.model],
8080
);
8181

82-
const ref = useRef<HTMLElement>();
82+
const ref = useRef<HTMLElement | undefined>(undefined);
8383

8484
useEffect(() => {
8585
if (

extensions/ql-vscode/src/view/model-editor/MethodRow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export type MethodRowProps = {
8585
export const MethodRow = (props: MethodRowProps) => {
8686
const { method, methodCanBeModeled, revealedMethodSignature } = props;
8787

88-
const ref = useRef<HTMLElement>();
88+
const ref = useRef<HTMLElement | undefined>(undefined);
8989

9090
useEffect(() => {
9191
if (method.signature === revealedMethodSignature) {

extensions/ql-vscode/src/view/results/AlertTablePathNodeRow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ interface Props {
1818
pathIndex: number;
1919
resultIndex: number;
2020
selectedItem: undefined | ResultKey;
21-
selectedItemRef: React.RefObject<HTMLTableRowElement>;
21+
selectedItemRef: React.RefObject<HTMLTableRowElement | null>;
2222
databaseUri: string;
2323
sourceLocationPrefix: string;
2424
run?: Run;

extensions/ql-vscode/src/view/results/AlertTablePathRow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export interface Props {
1919
resultIndex: number;
2020
currentPathExpanded: boolean;
2121
selectedItem: undefined | ResultKey;
22-
selectedItemRef: React.RefObject<HTMLTableRowElement>;
22+
selectedItemRef: React.RefObject<HTMLTableRowElement | null>;
2323
databaseUri: string;
2424
sourceLocationPrefix: string;
2525
run?: Run;

extensions/ql-vscode/src/view/results/AlertTableResultRow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export interface Props {
2020
resultIndex: number;
2121
expanded: Set<string>;
2222
selectedItem: undefined | ResultKey;
23-
selectedItemRef: React.RefObject<HTMLTableRowElement>;
23+
selectedItemRef: React.RefObject<HTMLTableRowElement | null>;
2424
databaseUri: string;
2525
sourceLocationPrefix: string;
2626
run?: Run;

extensions/ql-vscode/src/view/results/__tests__/AlertTablePathRow.spec.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import { createMockResults } from "../../../../test/factories/results/mockresult
55

66
describe(AlertTablePathRow.name, () => {
77
const render = (props?: Props) => {
8-
const mockRef = { current: null } as React.RefObject<HTMLTableRowElement>;
8+
const mockRef = {
9+
current: null,
10+
} as React.RefObject<HTMLTableRowElement | null>;
911
const results = createMockResults();
1012
const threadFlow = results[0]?.codeFlows?.[0]?.threadFlows?.[0];
1113

extensions/ql-vscode/src/view/results/__tests__/AlertTableResultRow.spec.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import { createMockResults } from "../../../../test/factories/results/mockresult
55

66
describe(AlertTableResultRow.name, () => {
77
const render = (props?: Props) => {
8-
const mockRef = { current: null } as React.RefObject<HTMLTableRowElement>;
8+
const mockRef = {
9+
current: null,
10+
} as React.RefObject<HTMLTableRowElement | null>;
911
const results = createMockResults();
1012

1113
reactRender(

extensions/ql-vscode/src/view/results/useScrollIntoView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import type { RefObject } from "react";
22
import { useEffect } from "react";
33

4-
export function useScrollIntoView<T>(
4+
export function useScrollIntoView<T, E extends HTMLElement = HTMLElement>(
55
selectedElement: T | undefined,
6-
selectedElementRef: RefObject<HTMLElement>,
6+
selectedElementRef: RefObject<E | null>,
77
) {
88
useEffect(() => {
99
const element = selectedElementRef.current;

0 commit comments

Comments
 (0)