Skip to content
TypeScript

perf(web): the SSH password prompt compiles with the React Compiler (#20490)

Julius Marminge079a349708dd
diff --git a/apps/web/reactCompiledFiles.ts b/apps/web/reactCompiledFiles.ts
index e7173a16639..8a63f8c34a4 100644
--- a/apps/web/reactCompiledFiles.ts
+++ b/apps/web/reactCompiledFiles.ts
@@ -65,4 +65,5 @@ export const REACT_COMPILED_FILES = [
"apps/web/src/components/media/MediaActions.tsx",
"apps/web/src/components/device/DeviceSetup.tsx",
"apps/web/src/components/device/DevicePanel.tsx",
+ "apps/web/src/components/desktop/SshPasswordPromptDialog.tsx",
] as const;
diff --git a/apps/web/src/components/desktop/SshPasswordPromptDialog.tsx b/apps/web/src/components/desktop/SshPasswordPromptDialog.tsx
index d3727ae210b..b7b995bc335 100644
--- a/apps/web/src/components/desktop/SshPasswordPromptDialog.tsx
+++ b/apps/web/src/components/desktop/SshPasswordPromptDialog.tsx
@@ -1,4 +1,7 @@
+import { settlePromise } from "@t3tools/client-runtime/state/runtime";
import type { DesktopSshPasswordPromptRequest } from "@t3tools/contracts";
+import * as AsyncResult from "effect/reactivity/AsyncResult";
+import * as Cause from "effect/Cause";
import { useEffect, useId, useRef, useState } from "react";
import { Button } from "../ui/button";
@@ -118,19 +121,16 @@ function ActiveSshPasswordPrompt({
isRespondingRef.current = true;
setIsResponding(true);
setResponseError(null);
- try {
- await window.desktopBridge?.resolveSshPasswordPrompt(requestId, nextPassword);
+ const result = await settlePromise(async () =>
+ window.desktopBridge?.resolveSshPasswordPrompt(requestId, nextPassword),
+ );
+ if (AsyncResult.isSuccess(result) || nextPassword === null) {
onRemove(requestId);
- } catch (error) {
- if (nextPassword === null) {
- onRemove(requestId);
- } else {
- setResponseError(getPromptErrorMessage(error));
- }
- } finally {
- isRespondingRef.current = false;
- setIsResponding(false);
+ } else {
+ setResponseError(getPromptErrorMessage(Cause.squash(result.cause)));
}
+ isRespondingRef.current = false;
+ setIsResponding(false);
};
const dismissExpiredPrompt = () => {