Skip to content

Commit 8ee0532

Browse files
authored
Update npm packages for the UI (#432)
Upgraded most packages to current as of 2025-05-09 for almost everything. Remove the erroneous extra dependency to old xterm package since the correct @xterm/xterm package was already included (suspect a bad merge) and it was causing issues with react 19.1. Switched to using the hooks exposed in the usehooks-ts package (this package was already referenced, suspect a bad merge) removing our private copies of useInterval, useIsMounted, useResizeObserver which are identical. Added import of JSX from react now needed because NPX is not in global scope in react 19.x. Explicitly cast the ref of included elements due to change in react 19.x
1 parent d0faf03 commit 8ee0532

14 files changed

+1647
-1289
lines changed

ui/package-lock.json

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

ui/package.json

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"preview": "vite preview"
2020
},
2121
"dependencies": {
22-
"@headlessui/react": "^2.2.0",
23-
"@headlessui/tailwindcss": "^0.2.1",
22+
"@headlessui/react": "^2.2.2",
23+
"@headlessui/tailwindcss": "^0.2.2",
2424
"@heroicons/react": "^2.2.0",
2525
"@vitejs/plugin-basic-ssl": "^1.2.0",
2626
"@xterm/addon-clipboard": "^0.1.0",
@@ -36,44 +36,43 @@
3636
"framer-motion": "^11.15.0",
3737
"lodash.throttle": "^4.1.1",
3838
"mini-svg-data-uri": "^1.4.4",
39-
"react": "^18.2.0",
39+
"react": "^19.1.0",
4040
"react-animate-height": "^3.2.3",
41-
"react-dom": "^18.2.0",
42-
"react-hot-toast": "^2.4.1",
43-
"react-icons": "^5.4.0",
41+
"react-dom": "^19.1.0",
42+
"react-hot-toast": "^2.5.2",
43+
"react-icons": "^5.5.0",
4444
"react-router-dom": "^6.22.3",
45-
"react-simple-keyboard": "^3.7.112",
45+
"react-simple-keyboard": "^3.8.71",
4646
"react-use-websocket": "^4.13.0",
47-
"react-xtermjs": "^1.0.9",
48-
"recharts": "^2.15.0",
47+
"react-xtermjs": "^1.0.10",
48+
"recharts": "^2.15.3",
4949
"tailwind-merge": "^2.5.5",
50-
"usehooks-ts": "^3.1.0",
51-
"validator": "^13.12.0",
52-
"xterm": "^5.3.0",
50+
"usehooks-ts": "^3.1.1",
51+
"validator": "^13.15.0",
5352
"zustand": "^4.5.2"
5453
},
5554
"devDependencies": {
56-
"@tailwindcss/forms": "^0.5.9",
57-
"@tailwindcss/typography": "^0.5.15",
58-
"@types/react": "^18.2.66",
59-
"@types/react-dom": "^18.3.0",
60-
"@types/semver": "^7.5.8",
61-
"@types/validator": "^13.12.2",
62-
"@typescript-eslint/eslint-plugin": "^8.25.0",
63-
"@typescript-eslint/parser": "^8.25.0",
64-
"@vitejs/plugin-react-swc": "^3.7.2",
65-
"autoprefixer": "^10.4.20",
66-
"eslint": "^8.20.0",
67-
"eslint-config-prettier": "^10.0.1",
55+
"@tailwindcss/forms": "^0.5.10",
56+
"@tailwindcss/typography": "^0.5.16",
57+
"@types/react": "^19.1.3",
58+
"@types/react-dom": "^19.1.3",
59+
"@types/semver": "^7.7.0",
60+
"@types/validator": "^13.15.0",
61+
"@typescript-eslint/eslint-plugin": "^8.32.0",
62+
"@typescript-eslint/parser": "^8.32.0",
63+
"@vitejs/plugin-react-swc": "^3.9.0",
64+
"autoprefixer": "^10.4.21",
65+
"eslint": "^9.26.0",
66+
"eslint-config-prettier": "^10.1.5",
6867
"eslint-plugin-import": "^2.31.0",
69-
"eslint-plugin-react": "^7.37.4",
70-
"eslint-plugin-react-hooks": "^5.1.0",
71-
"eslint-plugin-react-refresh": "^0.4.19",
72-
"postcss": "^8.4.49",
73-
"prettier": "^3.4.2",
68+
"eslint-plugin-react": "^7.37.5",
69+
"eslint-plugin-react-hooks": "^5.2.0",
70+
"eslint-plugin-react-refresh": "^0.4.20",
71+
"postcss": "^8.5.3",
72+
"prettier": "^3.5.3",
7473
"prettier-plugin-tailwindcss": "^0.6.11",
7574
"tailwindcss": "^3.4.17",
76-
"typescript": "^5.7.2",
75+
"typescript": "^5.8.3",
7776
"vite": "^5.2.0",
7877
"vite-tsconfig-paths": "^5.1.4"
7978
}

ui/src/components/Button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from "react";
1+
import React, { JSX } from "react";
22
import { FetcherWithComponents, Link, LinkProps, useNavigation } from "react-router-dom";
33

44
import ExtLink from "@/components/ExtLink";

ui/src/components/Checkbox.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Ref } from "react";
2-
import React, { forwardRef } from "react";
2+
import React, { forwardRef, JSX } from "react";
33
import clsx from "clsx";
44

55
import FieldLabel from "@/components/FieldLabel";

ui/src/components/InputField.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Ref } from "react";
2-
import React, { forwardRef } from "react";
2+
import React, { forwardRef, JSX } from "react";
33
import clsx from "clsx";
44

55
import FieldLabel from "@/components/FieldLabel";

ui/src/components/SelectMenuBasic.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from "react";
1+
import React, { JSX } from "react";
22
import clsx from "clsx";
33

44
import FieldLabel from "@/components/FieldLabel";

ui/src/components/Terminal.tsx

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,11 @@ function Terminal({
7979
return () => {
8080
setDisableKeyboardFocusTrap(false);
8181
};
82-
}, [enableTerminal, instance, ref, setDisableKeyboardFocusTrap, type]);
82+
}, [ref, instance, enableTerminal, setDisableKeyboardFocusTrap, type]);
8383

8484
const readyState = dataChannel.readyState;
8585
useEffect(() => {
86+
if (!instance) return;
8687
if (readyState !== "open") return;
8788

8889
const abortController = new AbortController();
@@ -93,11 +94,10 @@ function Terminal({
9394
// Handle binary data differently based on browser implementation
9495
// Firefox sends data as blobs, chrome sends data as arraybuffer
9596
if (binaryType === "arraybuffer") {
96-
instance?.write(new Uint8Array(e.data));
97+
instance.write(new Uint8Array(e.data));
9798
} else if (binaryType === "blob") {
9899
const reader = new FileReader();
99100
reader.onload = () => {
100-
if (!instance) return;
101101
if (!reader.result) return;
102102
instance.write(new Uint8Array(reader.result as ArrayBuffer));
103103
};
@@ -107,12 +107,12 @@ function Terminal({
107107
{ signal: abortController.signal },
108108
);
109109

110-
const onDataHandler = instance?.onData(data => {
110+
const onDataHandler = instance.onData(data => {
111111
dataChannel.send(data);
112112
});
113113

114114
// Setup escape key handler
115-
const onKeyHandler = instance?.onKey(e => {
115+
const onKeyHandler = instance.onKey(e => {
116116
const { domEvent } = e;
117117
if (domEvent.key === "Escape") {
118118
setTerminalType("none");
@@ -123,32 +123,32 @@ function Terminal({
123123

124124
// Send initial terminal size
125125
if (dataChannel.readyState === "open") {
126-
dataChannel.send(JSON.stringify({ rows: instance?.rows, cols: instance?.cols }));
126+
dataChannel.send(JSON.stringify({ rows: instance.rows, cols: instance.cols }));
127127
}
128128

129129
return () => {
130130
abortController.abort();
131-
onDataHandler?.dispose();
132-
onKeyHandler?.dispose();
131+
onDataHandler.dispose();
132+
onKeyHandler.dispose();
133133
};
134-
}, [dataChannel, instance, readyState, setDisableKeyboardFocusTrap, setTerminalType]);
134+
}, [instance, dataChannel, readyState, setDisableKeyboardFocusTrap, setTerminalType]);
135135

136136
useEffect(() => {
137137
if (!instance) return;
138138

139139
// Load the fit addon
140140
const fitAddon = new FitAddon();
141-
instance?.loadAddon(fitAddon);
141+
instance.loadAddon(fitAddon);
142142

143-
instance?.loadAddon(new ClipboardAddon());
144-
instance?.loadAddon(new Unicode11Addon());
145-
instance?.loadAddon(new WebLinksAddon());
143+
instance.loadAddon(new ClipboardAddon());
144+
instance.loadAddon(new Unicode11Addon());
145+
instance.loadAddon(new WebLinksAddon());
146146
instance.unicode.activeVersion = "11";
147147

148148
if (isWebGl2Supported) {
149149
const webGl2Addon = new WebglAddon();
150150
webGl2Addon.onContextLoss(() => webGl2Addon.dispose());
151-
instance?.loadAddon(webGl2Addon);
151+
instance.loadAddon(webGl2Addon);
152152
}
153153

154154
const handleResize = () => fitAddon.fit();
@@ -158,13 +158,11 @@ function Terminal({
158158
return () => {
159159
window.removeEventListener("resize", handleResize);
160160
};
161-
}, [ref, instance, dataChannel]);
161+
}, [ref, instance]);
162162

163163
return (
164164
<div
165-
onKeyDown={e => {
166-
e.stopPropagation();
167-
}}
165+
onKeyDown={e => e.stopPropagation()}
168166
onKeyUp={e => e.stopPropagation()}
169167
>
170168
<div>

ui/src/components/TextArea.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from "react";
1+
import React, { JSX } from "react";
22
import clsx from "clsx";
33

44
import FieldLabel from "@/components/FieldLabel";

ui/src/components/WebRTCVideo.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
useVideoStore,
1111
} from "@/hooks/stores";
1212
import { keys, modifiers } from "@/keyboardMappings";
13-
import { useResizeObserver } from "@/hooks/useResizeObserver";
13+
import { useResizeObserver } from "usehooks-ts";
1414
import { cx } from "@/cva.config";
1515
import VirtualKeyboard from "@components/VirtualKeyboard";
1616
import Actionbar from "@components/ActionBar";
@@ -67,7 +67,7 @@ export default function WebRTCVideo() {
6767

6868
// Video-related
6969
useResizeObserver({
70-
ref: videoElm,
70+
ref: videoElm as React.RefObject<HTMLElement>,
7171
onResize: ({ width, height }) => {
7272
// This is actually client size, not videoSize
7373
if (width && height) {

ui/src/hooks/useInterval.ts

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

0 commit comments

Comments
 (0)