From 3283f55e7ec46808638c8ee5cce24027c9696086 Mon Sep 17 00:00:00 2001 From: matt korwel Date: Fri, 20 Jun 2025 11:33:31 -0700 Subject: [PATCH] Auth timeout (#1263) --- packages/cli/src/ui/components/AuthInProgress.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/cli/src/ui/components/AuthInProgress.tsx b/packages/cli/src/ui/components/AuthInProgress.tsx index 804e2ff8..196097f2 100644 --- a/packages/cli/src/ui/components/AuthInProgress.tsx +++ b/packages/cli/src/ui/components/AuthInProgress.tsx @@ -5,7 +5,7 @@ */ import React, { useState, useEffect } from 'react'; -import { Box, Text } from 'ink'; +import { Box, Text, useInput } from 'ink'; import Spinner from 'ink-spinner'; import { Colors } from '../colors.js'; @@ -18,11 +18,17 @@ export function AuthInProgress({ }: AuthInProgressProps): React.JSX.Element { const [timedOut, setTimedOut] = useState(false); + useInput((_, key) => { + if (key.escape) { + onTimeout(); + } + }); + useEffect(() => { const timer = setTimeout(() => { setTimedOut(true); onTimeout(); - }, 30000); + }, 180000); return () => clearTimeout(timer); }, [onTimeout]); @@ -42,7 +48,7 @@ export function AuthInProgress({ ) : ( - Waiting for auth... + Waiting for auth... (Press ESC to cancel) )}