MCPcopy Index your code
hub / github.com/codeaashu/claude-code / PreflightStep

Function PreflightStep

src/utils/preflightChecks.tsx:78–147  ·  view source on GitHub ↗
(t0)

Source from the content-addressed store, hash-verified

76 onSuccess: () => void;
77}
78export function PreflightStep(t0) {
79 const $ = _c(12);
80 const {
81 onSuccess
82 } = t0;
83 const [result, setResult] = useState(null);
84 const [isChecking, setIsChecking] = useState(true);
85 const showSpinner = useTimeout(1000) && isChecking;
86 let t1;
87 let t2;
88 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
89 t1 = () => {
90 const run = async function run() {
91 const checkResult = await checkEndpoints();
92 setResult(checkResult);
93 setIsChecking(false);
94 };
95 run();
96 };
97 t2 = [];
98 $[0] = t1;
99 $[1] = t2;
100 } else {
101 t1 = $[0];
102 t2 = $[1];
103 }
104 useEffect(t1, t2);
105 let t3;
106 let t4;
107 if ($[2] !== onSuccess || $[3] !== result) {
108 t3 = () => {
109 if (result?.success) {
110 onSuccess();
111 } else {
112 if (result && !result.success) {
113 const timer = setTimeout(_temp, 100);
114 return () => clearTimeout(timer);
115 }
116 }
117 };
118 t4 = [result, onSuccess];
119 $[2] = onSuccess;
120 $[3] = result;
121 $[4] = t3;
122 $[5] = t4;
123 } else {
124 t3 = $[4];
125 t4 = $[5];
126 }
127 useEffect(t3, t4);
128 let t5;
129 if ($[6] !== isChecking || $[7] !== result || $[8] !== showSpinner) {
130 t5 = isChecking && showSpinner ? <Box paddingLeft={1}><Spinner /><Text>Checking connectivity...</Text></Box> : !result?.success && !isChecking && <Box flexDirection="column" gap={1}><Text color="error">Unable to connect to Anthropic services</Text><Text color="error">{result?.error}</Text>{result?.sslHint ? <Box flexDirection="column" gap={1}><Text>{result.sslHint}</Text><Text color="suggestion">See https://code.claude.com/docs/en/network-config</Text></Box> : <Box flexDirection="column" gap={1}><Text>Please check your internet connection and network settings.</Text><Text>Note: Claude Code might not be available in your country. Check supported countries at{" "}<Text color="suggestion">https://anthropic.com/supported-countries</Text></Text></Box>}</Box>;
131 $[6] = isChecking;
132 $[7] = result;
133 $[8] = showSpinner;
134 $[9] = t5;
135 } else {

Callers

nothing calls this directly

Calls 2

useTimeoutFunction · 0.85
runFunction · 0.70

Tested by

no test coverage detected