MCPcopy Create free account
hub / github.com/Noumena-Network/code / PreflightStep

Function PreflightStep

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

Source from the content-addressed store, hash-verified

113 onSuccess: () => void;
114}
115export function PreflightStep(t0) {
116 const $ = _c(12);
117 const {
118 onSuccess
119 } = t0;
120 const [result, setResult] = useState(null);
121 const [isChecking, setIsChecking] = useState(true);
122 const showSpinner = useTimeout(1000) && isChecking;
123 let t1;
124 let t2;
125 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
126 t1 = () => {
127 const run = async function run() {
128 const checkResult = await checkEndpoints();
129 setResult(checkResult);
130 setIsChecking(false);
131 };
132 run();
133 };
134 t2 = [];
135 $[0] = t1;
136 $[1] = t2;
137 } else {
138 t1 = $[0];
139 t2 = $[1];
140 }
141 useEffect(t1, t2);
142 let t3;
143 let t4;
144 if ($[2] !== onSuccess || $[3] !== result) {
145 t3 = () => {
146 if (result?.success) {
147 onSuccess();
148 } else {
149 if (result && !result.success) {
150 const timer = setTimeout(_temp, 100);
151 return () => clearTimeout(timer);
152 }
153 }
154 };
155 t4 = [result, onSuccess];
156 $[2] = onSuccess;
157 $[3] = result;
158 $[4] = t3;
159 $[5] = t4;
160 } else {
161 t3 = $[4];
162 t4 = $[5];
163 }
164 useEffect(t3, t4);
165 let t5;
166 if ($[6] !== isChecking || $[7] !== result || $[8] !== showSpinner) {
167 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 Noumena services</Text><Text color="error">{result?.error}</Text>{result?.sslHint ? <Box flexDirection="column" gap={1}><Text>{result.sslHint}</Text></Box> : <Box flexDirection="column" gap={1}><Text>Please check your internet connection, network settings, and any Noumena service URL overrides.</Text></Box>}</Box>;
168 $[6] = isChecking;
169 $[7] = result;
170 $[8] = showSpinner;
171 $[9] = t5;
172 } else {

Callers

nothing calls this directly

Calls 2

useTimeoutFunction · 0.85
runFunction · 0.70

Tested by

no test coverage detected