fix: uuid crypto error when creating a tab on http based setups

This commit is contained in:
LukeGus
2026-05-28 22:14:05 -05:00
parent dd008e4d6b
commit bc386b1247
+5 -1
View File
@@ -547,7 +547,11 @@ export function AppShell({
restore?: { instanceId: string; restoredSessionId: string | null }, restore?: { instanceId: string; restoredSessionId: string | null },
) { ) {
const tabId = `${host.name}-${type}-${Date.now()}`; const tabId = `${host.name}-${type}-${Date.now()}`;
const instanceId = restore?.instanceId ?? crypto.randomUUID(); const instanceId =
restore?.instanceId ??
(typeof crypto.randomUUID === "function"
? crypto.randomUUID()
: `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`);
const openedAt = Date.now(); const openedAt = Date.now();
const ref = type === "terminal" ? createRef() : undefined; const ref = type === "terminal" ? createRef() : undefined;
if (ref) terminalRefs.current.set(tabId, ref); if (ref) terminalRefs.current.set(tabId, ref);