Skip to content

Commit b0128e5

Browse files
perf(web): the device panel compiles with the React Compiler
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 0861936 commit b0128e5

2 files changed

Lines changed: 21 additions & 26 deletions

File tree

‎apps/web/reactCompiledFiles.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,5 @@ export const REACT_COMPILED_FILES = [
6464
"apps/web/src/components/media/MediaVideoPlayer.tsx",
6565
"apps/web/src/components/media/MediaActions.tsx",
6666
"apps/web/src/components/device/DeviceSetup.tsx",
67+
"apps/web/src/components/device/DevicePanel.tsx",
6768
] as const;

‎apps/web/src/components/device/DevicePanel.tsx‎

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type {
66
ScopedThreadRef,
77
} from "@t3tools/contracts";
88
import { Smartphone, X } from "lucide-react";
9-
import { useEffect, useMemo, useState } from "react";
9+
import { useEffect, useState } from "react";
1010

1111
import { usePreviewMiniPlayerStore } from "~/previewMiniPlayerStore";
1212
import { useRightPanelStore, type RightPanelSurface } from "~/rightPanelStore";
@@ -54,10 +54,7 @@ export function DevicePanel(props: {
5454
void list({ environmentId, input: {} });
5555
}, [environmentId, list, loaded, props.visible, hostDisabled]);
5656

57-
const sessions = useMemo(
58-
() => state.sessions.filter((session) => session.threadId === threadId),
59-
[state.sessions, threadId],
60-
);
57+
const sessions = state.sessions.filter((session) => session.threadId === threadId);
6158
const activeSession = props.surface.target
6259
? sessions.find(
6360
(session) =>
@@ -71,34 +68,31 @@ export function DevicePanel(props: {
7168
)
7269
: undefined;
7370

74-
const grouped = useMemo(() => groupDevices(state), [state]);
71+
const grouped = groupDevices(state);
7572

7673
const selectDevice = async (value: string) => {
7774
const device = state.devices.find((candidate) => deviceKey(candidate) === value);
7875
if (!device) return;
7976
setOperationError(null);
8077
setPendingDevice(device);
81-
try {
82-
const result = await open({
83-
environmentId,
84-
input: {
85-
threadId,
86-
hostId: device.hostId,
87-
deviceId: device.id,
88-
platform: device.platform,
89-
},
78+
const result = await open({
79+
environmentId,
80+
input: {
81+
threadId,
82+
hostId: device.hostId,
83+
deviceId: device.id,
84+
platform: device.platform,
85+
},
86+
});
87+
if (result._tag === "Failure") setOperationError(formatEnvironmentQueryError(result.cause));
88+
else
89+
useRightPanelStore.getState().openDevice(props.threadRef, {
90+
hostId: result.value.hostId,
91+
deviceId: result.value.deviceId,
92+
platform: device.platform,
93+
name: device.name,
9094
});
91-
if (result._tag === "Failure") setOperationError(formatEnvironmentQueryError(result.cause));
92-
else
93-
useRightPanelStore.getState().openDevice(props.threadRef, {
94-
hostId: result.value.hostId,
95-
deviceId: result.value.deviceId,
96-
platform: device.platform,
97-
name: device.name,
98-
});
99-
} finally {
100-
setPendingDevice(null);
101-
}
95+
setPendingDevice(null);
10296
};
10397

10498
const floatActive = () => {

0 commit comments

Comments
 (0)