MCPcopy Index your code
hub / github.com/coder/coder / proxyLatencyLoading

Function proxyLatencyLoading

site/src/modules/dashboard/Navbar/ProxyMenu.tsx:39–54  ·  view source on GitHub ↗
(proxy: TypesGen.Region)

Source from the content-addressed store, hash-verified

37 const { permissions } = useAuthenticated();
38
39 const proxyLatencyLoading = (proxy: TypesGen.Region): boolean => {
40 if (!refetchDate) {
41 // Only show loading if the user manually requested a refetch
42 return false;
43 }
44
45 // Only show a loading spinner if:
46 // - A latency exists. This means the latency was fetched at some point, so
47 // the loader *should* be resolved.
48 // - The proxy is healthy. If it is not, the loader might never resolve.
49 // - The latency reported is older than the refetch date. This means the
50 // latency is stale and we should show a loading spinner until the new
51 // latency is fetched.
52 const latency = latencies[proxy.id];
53 return proxy.healthy && latency !== undefined && latency.at < refetchDate;
54 };
55
56 // This endpoint returns a 404 when not using enterprise.
57 // If we don't return null, then it looks like this is

Callers 1

ProxyMenuFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected