diff --git a/components/terminal/hooks/useTerminalAuthState.ts b/components/terminal/hooks/useTerminalAuthState.ts index 1796c0d92..b4c577d13 100644 --- a/components/terminal/hooks/useTerminalAuthState.ts +++ b/components/terminal/hooks/useTerminalAuthState.ts @@ -1,6 +1,6 @@ import type { Terminal as XTerm } from "@xterm/xterm"; import { useCallback, useEffect, useMemo, useState } from "react"; -import type { MutableRefObject } from "react"; +import type { RefObject } from "react"; import type { Host, TerminalSession } from "../../../types"; import type { PendingAuth } from "../runtime/createTerminalSessionStarters"; import type { TerminalAuthMethod } from "../TerminalAuthDialog"; @@ -16,8 +16,8 @@ export const useTerminalAuthState = ({ setProgressLogs, }: { host: Host; - pendingAuthRef: MutableRefObject; - termRef: MutableRefObject; + pendingAuthRef: RefObject; + termRef: RefObject; onUpdateHost?: (host: Host) => void; onStartSsh: (term: XTerm) => void; setStatus: (status: TerminalSession["status"]) => void; diff --git a/components/terminal/hooks/useTerminalContextActions.ts b/components/terminal/hooks/useTerminalContextActions.ts index b39c4e7ef..e4909d05a 100644 --- a/components/terminal/hooks/useTerminalContextActions.ts +++ b/components/terminal/hooks/useTerminalContextActions.ts @@ -1,6 +1,6 @@ import type { Terminal as XTerm } from "@xterm/xterm"; import { useCallback } from "react"; -import type { MutableRefObject } from "react"; +import type { RefObject } from "react"; import { logger } from "../../../lib/logger"; type TerminalBackendWriteApi = { @@ -13,8 +13,8 @@ export const useTerminalContextActions = ({ terminalBackend, onHasSelectionChange, }: { - termRef: MutableRefObject; - sessionRef: MutableRefObject; + termRef: RefObject; + sessionRef: RefObject; terminalBackend: TerminalBackendWriteApi; onHasSelectionChange?: (hasSelection: boolean) => void; }) => { @@ -60,4 +60,3 @@ export const useTerminalContextActions = ({ return { onCopy, onPaste, onSelectAll, onClear, onSelectWord }; }; - diff --git a/components/terminal/hooks/useTerminalSearch.ts b/components/terminal/hooks/useTerminalSearch.ts index feeb5041a..6a2e25e0c 100644 --- a/components/terminal/hooks/useTerminalSearch.ts +++ b/components/terminal/hooks/useTerminalSearch.ts @@ -1,7 +1,7 @@ import type { SearchAddon } from "@xterm/addon-search"; import type { Terminal as XTerm } from "@xterm/xterm"; import { useCallback, useRef, useState } from "react"; -import type { MutableRefObject } from "react"; +import type { RefObject } from "react"; type SearchMatchCount = { current: number; total: number } | null; @@ -9,8 +9,8 @@ export const useTerminalSearch = ({ searchAddonRef, termRef, }: { - searchAddonRef: MutableRefObject; - termRef: MutableRefObject; + searchAddonRef: RefObject; + termRef: RefObject; }) => { const [isSearchOpen, setIsSearchOpen] = useState(false); const [searchMatchCount, setSearchMatchCount] = useState(null); @@ -120,4 +120,3 @@ export const useTerminalSearch = ({ handleCloseSearch, }; }; - diff --git a/components/terminal/runtime/createTerminalSessionStarters.ts b/components/terminal/runtime/createTerminalSessionStarters.ts index 5dbb7ffa3..c0b01c821 100644 --- a/components/terminal/runtime/createTerminalSessionStarters.ts +++ b/components/terminal/runtime/createTerminalSessionStarters.ts @@ -1,7 +1,7 @@ import type { FitAddon } from "@xterm/addon-fit"; import type { SerializeAddon } from "@xterm/addon-serialize"; import type { Terminal as XTerm } from "@xterm/xterm"; -import type { Dispatch, MutableRefObject, SetStateAction } from "react"; +import type { Dispatch, RefObject, SetStateAction } from "react"; import { logger } from "../../../lib/logger"; import type { Host, SSHKey, TerminalSession, TerminalSettings } from "../../../types"; @@ -60,15 +60,15 @@ export type TerminalSessionStartersContext = { terminalSettings?: TerminalSettings; terminalBackend: TerminalBackendApi; - sessionRef: MutableRefObject; - hasConnectedRef: MutableRefObject; - hasRunStartupCommandRef: MutableRefObject; - disposeDataRef: MutableRefObject<(() => void) | null>; - disposeExitRef: MutableRefObject<(() => void) | null>; - fitAddonRef: MutableRefObject; - serializeAddonRef: MutableRefObject; - highlightProcessorRef: MutableRefObject<(text: string) => string>; - pendingAuthRef: MutableRefObject; + sessionRef: RefObject; + hasConnectedRef: RefObject; + hasRunStartupCommandRef: RefObject; + disposeDataRef: RefObject<(() => void) | null>; + disposeExitRef: RefObject<(() => void) | null>; + fitAddonRef: RefObject; + serializeAddonRef: RefObject; + highlightProcessorRef: RefObject<(text: string) => string>; + pendingAuthRef: RefObject; updateStatus: (next: TerminalSession["status"]) => void; setStatus: Dispatch>; diff --git a/components/terminal/runtime/createXTermRuntime.ts b/components/terminal/runtime/createXTermRuntime.ts index 117dbac20..4ca3d0aba 100644 --- a/components/terminal/runtime/createXTermRuntime.ts +++ b/components/terminal/runtime/createXTermRuntime.ts @@ -4,7 +4,7 @@ import { SerializeAddon } from "@xterm/addon-serialize"; import { WebLinksAddon } from "@xterm/addon-web-links"; import { WebglAddon } from "@xterm/addon-webgl"; import { Terminal as XTerm } from "@xterm/xterm"; -import type { Dispatch, MutableRefObject, SetStateAction } from "react"; +import type { Dispatch, RefObject, SetStateAction } from "react"; import { checkAppShortcut, getAppLevelActions, @@ -45,18 +45,18 @@ export type CreateXTermRuntimeContext = { host: Host; fontSize: number; terminalTheme: TerminalTheme; - terminalSettingsRef: MutableRefObject; + terminalSettingsRef: RefObject; terminalBackend: TerminalBackendApi; - sessionRef: MutableRefObject; + sessionRef: RefObject; - hotkeySchemeRef: MutableRefObject<"disabled" | "mac" | "pc">; - keyBindingsRef: MutableRefObject; - onHotkeyActionRef: MutableRefObject< + hotkeySchemeRef: RefObject<"disabled" | "mac" | "pc">; + keyBindingsRef: RefObject; + onHotkeyActionRef: RefObject< ((action: string, event: KeyboardEvent) => void) | undefined >; - isBroadcastEnabledRef: MutableRefObject; - onBroadcastInputRef: MutableRefObject< + isBroadcastEnabledRef: RefObject; + onBroadcastInputRef: RefObject< ((data: string, sourceSessionId: string) => void) | undefined >; @@ -68,7 +68,7 @@ export type CreateXTermRuntimeContext = { hostLabel: string, sessionId: string, ) => void; - commandBufferRef: MutableRefObject; + commandBufferRef: RefObject; setIsSearchOpen: Dispatch>; };