refactor(ui): Don't fetch KeybardAndMouse Icon on every re-render (#795)

This commit is contained in:
Adam Shiervani
2025-09-11 19:57:35 +02:00
committed by GitHub
parent 6202e3cafa
commit 8d1a66806c

View File

@@ -22,14 +22,6 @@ const USBStateMap: Record<USBStates, string> = {
"not attached": "Disconnected",
suspended: "Low power mode",
};
export default function USBStateStatus({
state,
peerConnectionState,
}: {
state: USBStates;
peerConnectionState?: RTCPeerConnectionState | null;
}) {
const StatusCardProps: StatusProps = {
configured: {
icon: ({ className }) => (
@@ -63,6 +55,15 @@ export default function USBStateStatus({
statusIndicatorClassName: "bg-green-500 border-green-600",
},
};
export default function USBStateStatus({
state,
peerConnectionState,
}: {
state: USBStates;
peerConnectionState?: RTCPeerConnectionState | null;
}) {
const props = StatusCardProps[state];
if (!props) {
console.warn("Unsupported USB state: ", state);